:root {
  --brand-purple: #61265e;
  --brand-plum: #8e3459;
  --brand-magenta: #ac3a58;
  --brand-red: #c84152;
  --brand-coral: #eb5e55;
  --brand-salmon: #ef7b66;
  --brand-yellow: #fec44b;
  --text: #291d28;
  --text-80: #544b53;
  --text-60: #686169;
  --line: #d4d2d4;
  --line-strong: #aaa5a9;
  --surface: #ffffff;
  --surface-muted: #f7f6f7;
  --surface-soft: #e9e8e9;
  --danger: #a92f39;
  --shadow: 0 16px 42px rgba(41, 29, 40, 0.1);
  --radius: 8px;
  font-family: Lato, Arial, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--surface-muted);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #ffffff 0, var(--surface-muted) 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto auto 1fr;
}

.rainbow-bar {
  height: 8px;
  background: linear-gradient(
    90deg,
    var(--brand-yellow) 0 14%,
    var(--brand-salmon) 14% 28%,
    var(--brand-coral) 28% 42%,
    var(--brand-red) 42% 58%,
    var(--brand-magenta) 58% 74%,
    var(--brand-plum) 74% 87%,
    var(--brand-purple) 87% 100%
  );
}

.topbar {
  min-height: 76px;
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) auto;
  align-items: center;
  gap: 24px;
  padding: 10px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

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

.brand img {
  width: 52px;
  height: 56px;
  object-fit: contain;
}

.brand strong,
.workspace__head h1,
.step__title,
.field label,
.section-label,
.button,
.status,
.summary__head strong {
  font-family: Montserrat, Arial, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.brand strong {
  display: block;
  color: var(--brand-purple);
  font-size: 15px;
  line-height: 1.2;
}

.brand span,
.context span,
.side-note,
.muted {
  color: var(--text-60);
}

.brand span {
  display: block;
  margin-top: 2px;
  font-size: 12px;
}

.context {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto;
  align-items: center;
  justify-content: center;
  gap: 14px;
  font-size: 13px;
  min-width: 0;
}

.context div {
  min-width: 0;
}

.context span {
  display: block;
  font-size: 11px;
}

.context strong {
  display: block;
  color: var(--text);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.context a {
  color: var(--brand-purple);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.language-select {
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: white;
  color: var(--text);
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 800;
  outline: none;
}

.language-select:focus {
  border-color: var(--brand-coral);
  box-shadow: 0 0 0 3px rgba(235, 94, 85, 0.16);
}

.layout {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr) 380px;
  gap: 18px;
}

.left-rail {
  display: grid;
  gap: 14px;
  align-self: start;
}

.stepper,
.management-panel,
.workspace,
.summary {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.stepper {
  padding: 14px;
  align-self: start;
}

.management-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
}

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

.management-panel__head strong {
  display: block;
  color: var(--brand-purple);
  font-family: Montserrat, Arial, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
}

.management-panel__head span {
  display: block;
  margin-top: 4px;
  color: var(--text-60);
  font-size: 12px;
  line-height: 1.35;
}

.management-search {
  min-height: 38px;
}

.organisation-list {
  display: grid;
  gap: 8px;
  max-height: 430px;
  overflow: auto;
  padding-right: 2px;
}

.organisation-row {
  width: 100%;
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  padding: 11px;
  color: var(--text);
  text-align: left;
}

.organisation-row:hover,
.organisation-row.is-selected {
  border-color: rgba(235, 94, 85, 0.55);
  background: #fff5f4;
}

.organisation-row.is-selected {
  box-shadow: inset 0 0 0 1px rgba(235, 94, 85, 0.2);
}

.organisation-row__title {
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
}

.organisation-row__id {
  color: var(--text-60);
  font-size: 11px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.organisation-row__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  color: var(--text-60);
  font-size: 11px;
}

.management-save {
  width: 100%;
}

.step {
  width: 100%;
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  text-align: left;
}

.step + .step {
  margin-top: 4px;
}

.step__number {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--brand-purple);
  font-size: 12px;
  font-weight: 800;
}

.step__title {
  display: block;
  font-size: 13px;
  font-weight: 800;
}

.step__copy {
  display: block;
  margin-top: 3px;
  color: var(--text-60);
  font-size: 12px;
  line-height: 1.35;
}

.step.is-active {
  border-color: rgba(196, 65, 82, 0.28);
  background: #fff5f4;
}

.step.is-active .step__number {
  border-color: var(--brand-purple);
  background: var(--brand-purple);
  color: white;
}

.step.is-complete .step__number {
  border-color: var(--brand-coral);
  background: var(--brand-coral);
  color: white;
}

.workspace {
  min-height: 740px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
}

.workspace__head {
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.workspace__head h1 {
  margin: 0;
  color: var(--brand-purple);
  font-size: 25px;
  line-height: 1.2;
  letter-spacing: 0;
}

.workspace__head p {
  margin: 8px 0 0;
  max-width: 820px;
  color: var(--text-60);
  font-size: 14px;
  line-height: 1.55;
}

.workspace__body {
  padding: 22px 24px;
}

.workspace__foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 18px 24px;
  border-top: 1px solid var(--line);
  background: var(--surface-muted);
}

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

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

.field {
  display: grid;
  gap: 7px;
}

.field label,
.section-label {
  color: var(--brand-purple);
  font-size: 12px;
  font-weight: 800;
}

.field small {
  color: var(--text-60);
  line-height: 1.35;
}

.input,
.select,
.textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: white;
  color: var(--text);
  padding: 10px 11px;
  font-size: 14px;
  outline: none;
}

.textarea {
  min-height: 92px;
  resize: vertical;
  line-height: 1.45;
}

.textarea--json {
  min-height: 180px;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--brand-coral);
  box-shadow: 0 0 0 3px rgba(235, 94, 85, 0.16);
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.party-card,
.claim-card,
.right-card {
  position: relative;
  display: block;
  min-height: 94px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  text-align: left;
}

.party-card.is-selected,
.claim-card.is-selected,
.right-card.is-selected {
  border-color: var(--brand-coral);
  background: #fff5f4;
  box-shadow: inset 0 0 0 1px rgba(235, 94, 85, 0.26);
}

.party-card strong,
.claim-card strong,
.right-card strong {
  display: block;
  color: var(--text);
  font-size: 14px;
}

.party-card span,
.claim-card span,
.right-card span {
  display: block;
  margin-top: 6px;
  color: var(--text-60);
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.license-group {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.license-group__head {
  display: grid;
  gap: 5px;
  border-left: 4px solid var(--brand-coral);
  padding-left: 12px;
}

.license-group__head strong {
  color: var(--brand-purple);
  font-family: Montserrat, Arial, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
}

.license-group__head span {
  color: var(--text-60);
  font-size: 13px;
  line-height: 1.4;
}

.license-group--dpv .license-group__head {
  border-left-color: var(--brand-yellow);
}

.divider {
  height: 1px;
  background: var(--line);
  margin: 22px 0;
}

.condition-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px minmax(0, 1fr) 40px;
  gap: 10px;
  align-items: center;
}

.condition-row + .condition-row {
  margin-top: 10px;
}

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

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 6px 10px;
  background: white;
  color: var(--brand-purple);
  font-size: 12px;
  font-weight: 750;
}

.chip.is-on {
  border-color: rgba(235, 94, 85, 0.5);
  background: #fff5f4;
}

.badge-grid,
.validation-list,
.json-grid,
.bundle-list {
  display: grid;
  gap: 10px;
}

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

.badge-grid div,
.validation-item,
.bundle-item,
.claim-section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
}

.badge-grid div {
  display: grid;
  gap: 4px;
  padding: 12px;
}

.badge-grid span,
.bundle-item span,
.claim-section__head span {
  color: var(--text-60);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.badge-grid strong,
.bundle-item strong {
  color: var(--text);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.validation-list {
  margin-top: 14px;
}

.validation-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  color: var(--text);
  font-size: 13px;
  font-weight: 750;
}

.claim-section {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.claim-section + .claim-section {
  margin-top: 14px;
}

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

.claim-section__head strong {
  display: block;
  color: var(--brand-purple);
  font-family: Montserrat, Arial, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
}

.is-disabled {
  opacity: 0.42;
  pointer-events: none;
}

.json-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.bundle-list {
  margin-top: 12px;
}

.bundle-item {
  display: grid;
  gap: 5px;
  padding: 11px 12px;
}

.summary {
  align-self: start;
  overflow: hidden;
}

.summary__head,
.summary__section {
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.summary__head {
  background: var(--brand-purple);
  color: white;
}

.summary__head img {
  display: block;
  width: 62px;
  height: 32px;
  object-fit: contain;
  object-position: left center;
  margin-bottom: 12px;
}

.summary__head strong {
  display: block;
  font-size: 15px;
}

.summary__head span {
  display: block;
  margin-top: 5px;
  color: #e9e8e9;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.kv {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 8px;
  font-size: 12px;
}

.kv + .kv {
  margin-top: 9px;
}

.kv span:first-child {
  color: var(--text-60);
}

.kv span:last-child {
  color: var(--text);
  font-weight: 750;
  overflow-wrap: anywhere;
}

.code {
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--text);
  color: #fff8f4;
  padding: 12px;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.code--small {
  max-height: 170px;
  margin: 12px 0 0;
}

.qr {
  display: grid;
  place-items: center;
  min-height: 170px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: white;
}

.qr svg {
  width: 154px;
  height: 154px;
}

.offer-uri {
  width: 100%;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  color: var(--text);
  background: var(--surface-muted);
  font-size: 11px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.credential-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.credential-card {
  display: grid;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  padding: 12px;
}

.credential-card.is-revoked {
  background: var(--surface-muted);
}

.credential-card__head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.credential-card__head strong {
  color: var(--text);
  font-size: 13px;
  line-height: 1.3;
}

.credential-card__meta,
.credential-card__line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--text-60);
  font-size: 11px;
  line-height: 1.35;
}

.credential-card__line strong {
  color: var(--text);
  text-align: right;
  overflow-wrap: anywhere;
}

.credential-id {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px;
  background: var(--surface-muted);
  color: var(--text-60);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill--compact {
  min-height: 20px;
  padding: 3px 7px;
  font-size: 10px;
}

.status-pill.is-active {
  background: #eff9ef;
  color: #246b35;
}

.status-pill.is-draft {
  background: var(--surface-soft);
  color: var(--text-60);
}

.status-pill.is-validated {
  background: #fff8dd;
  color: #6b520d;
}

.status-pill.is-issued {
  background: #eff9ef;
  color: #246b35;
}

.status-pill.is-revoked {
  background: #fff3f3;
  color: var(--danger);
}

.empty-state {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 12px;
  color: var(--text-60);
  background: white;
  font-size: 12px;
  text-align: center;
}

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

.protocol-list div {
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  background: var(--surface-muted);
}

.protocol-list span {
  color: var(--text-60);
  font-size: 11px;
}

.protocol-list strong {
  color: var(--text);
  font-size: 11px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.button--compact {
  min-height: 32px;
  padding: 7px 10px;
  font-size: 12px;
}

.button--primary {
  background: var(--brand-coral);
  color: white;
}

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

.button--secondary {
  border-color: rgba(254, 196, 75, 0.75);
  background: #fff8dd;
  color: var(--text);
}

.button--ghost {
  border-color: var(--line-strong);
  background: white;
  color: var(--text);
}

.button--danger {
  border-color: rgba(169, 47, 57, 0.32);
  background: #fff3f3;
  color: var(--danger);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 999px;
  padding: 6px 10px;
  background: #fff8dd;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand-yellow);
}

.error {
  margin-top: 12px;
  border: 1px solid rgba(169, 47, 57, 0.28);
  border-radius: var(--radius);
  background: #fff3f3;
  color: #8d2323;
  padding: 10px 12px;
  font-size: 13px;
}

.notice {
  margin-top: 12px;
  border: 1px solid rgba(36, 107, 53, 0.22);
  border-radius: var(--radius);
  background: #eff9ef;
  color: #246b35;
  padding: 10px 12px;
  font-size: 13px;
}

.hidden {
  display: none !important;
}

@media (max-width: 1180px) {
  .layout {
    grid-template-columns: 300px minmax(0, 1fr);
  }

  .summary {
    grid-column: 1 / -1;
  }
}

@media (max-width: 820px) {
  .topbar {
    height: auto;
    grid-template-columns: 1fr;
    align-items: start;
    padding: 16px;
  }

  .brand {
    min-width: 0;
  }

  .context,
  .top-actions {
    justify-content: flex-start;
  }

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

  .layout {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .left-rail {
    gap: 10px;
  }

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

  .organisation-list {
    max-height: 320px;
  }

  .step + .step {
    margin-top: 0;
  }

  .grid-2,
  .grid-3,
  .choice-grid,
  .condition-row,
  .badge-grid,
  .json-grid {
    grid-template-columns: 1fr;
  }

  .workspace {
    min-height: 0;
  }
}
