:root {
  color-scheme: light;
  --ink: #10261f;
  --ink-soft: #3d554d;
  --paper: #f3efe5;
  --paper-strong: #fffdf7;
  --line: rgba(16, 38, 31, 0.14);
  --green: #08a66c;
  --green-dark: #087e58;
  --mint: #cfeadd;
  --gold: #d8a32b;
  --peach: #f2c5aa;
  --red: #b74539;
  --navy: #17324c;
  --shadow: 0 24px 70px rgba(20, 45, 36, 0.13);
  --radius: 24px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 0%, rgba(242, 197, 170, 0.42), transparent 30rem),
    radial-gradient(circle at 85% 18%, rgba(207, 234, 221, 0.8), transparent 32rem),
    var(--paper);
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(8, 166, 108, 0.32);
  outline-offset: 3px;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  width: min(1180px, calc(100% - 32px));
  margin: 18px auto 0;
  min-height: 72px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 24px;
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 22px;
  background: rgba(255, 253, 247, 0.84);
  box-shadow: 0 12px 34px rgba(16, 38, 31, 0.08);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 12px;
  z-index: 20;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
  min-width: 210px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px 14px 14px 5px;
  color: white;
  background: var(--ink);
  font-family: Georgia, serif;
  font-size: 25px;
  font-weight: 700;
  box-shadow: inset -7px -7px 0 rgba(8, 166, 108, 0.35);
}

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

.brand strong {
  letter-spacing: 0.06em;
}

.brand small {
  margin-top: 2px;
  color: var(--ink-soft);
  font-size: 0.64rem;
  letter-spacing: 0.13em;
}

.primary-nav {
  display: flex;
  justify-content: center;
  gap: 5px;
  flex: 1;
}

.primary-nav button {
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  color: var(--ink-soft);
  background: transparent;
  cursor: pointer;
  font-weight: 700;
}

.primary-nav button:hover,
.primary-nav button.active {
  color: var(--ink);
  background: var(--mint);
}

.mode-pill {
  padding: 8px 12px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
}

.mode-pill span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(8, 166, 108, 0.12);
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 32px auto 80px;
  flex: 1;
}

.loading-state {
  min-height: 55vh;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 20px;
  color: var(--ink-soft);
}

.loading-orbit {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid rgba(8, 166, 108, 0.15);
  border-top-color: var(--green);
  animation: orbit 0.9s linear infinite;
}

@keyframes orbit {
  to {
    transform: rotate(360deg);
  }
}

.hero {
  min-height: 550px;
  padding: clamp(28px, 5vw, 68px);
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(300px, 0.7fr);
  gap: clamp(32px, 6vw, 74px);
  align-items: center;
  overflow: hidden;
  border-radius: 38px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent),
    var(--ink);
  color: white;
  box-shadow: var(--shadow);
  position: relative;
}

.hero::before,
.hero::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.hero::before {
  width: 390px;
  height: 390px;
  right: -110px;
  top: -120px;
  background: rgba(8, 166, 108, 0.34);
}

.hero::after {
  width: 260px;
  height: 260px;
  right: 180px;
  bottom: -170px;
  background: rgba(216, 163, 43, 0.24);
}

.hero-copy,
.hero-card {
  position: relative;
  z-index: 1;
}

.eyebrow {
  margin: 0 0 16px;
  color: var(--gold);
  font-size: 0.76rem;
  letter-spacing: 0.16em;
  font-weight: 850;
  text-transform: uppercase;
}

.hero h1,
.page-heading h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  line-height: 0.98;
  letter-spacing: -0.045em;
}

.hero h1 {
  max-width: 760px;
  font-size: clamp(3.2rem, 7vw, 6.2rem);
}

.hero-summary {
  max-width: 650px;
  margin: 28px 0 0;
  color: rgba(255, 255, 255, 0.76);
  font-size: clamp(1rem, 2vw, 1.22rem);
  line-height: 1.65;
}

.trust-line {
  margin-top: 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.trust-line span,
.status-chip,
.tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 750;
}

.trust-line span {
  padding: 9px 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.06);
}

.hero-card {
  padding: 28px;
  border-radius: 28px;
  color: var(--ink);
  background: var(--paper-strong);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.24);
}

.hero-card h2,
.panel h2,
.panel h3 {
  margin: 0;
  line-height: 1.15;
}

.hero-card p {
  color: var(--ink-soft);
  line-height: 1.55;
}

.identity-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.identity-button {
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  color: var(--ink);
  background: white;
  cursor: pointer;
  text-align: left;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.identity-button:hover {
  transform: translateY(-2px);
  border-color: var(--green);
}

.identity-button strong,
.identity-button small {
  display: block;
}

.identity-button small {
  margin-top: 4px;
  color: var(--ink-soft);
}

.primary-button,
.secondary-button,
.danger-button,
.text-button {
  min-height: 44px;
  border-radius: 13px;
  padding: 10px 16px;
  border: 0;
  cursor: pointer;
  font-weight: 800;
}

.primary-button {
  color: white;
  background: var(--green);
  box-shadow: 0 10px 22px rgba(8, 166, 108, 0.22);
}

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

.secondary-button {
  color: var(--ink);
  background: var(--mint);
}

.danger-button {
  color: white;
  background: var(--red);
}

.text-button {
  color: var(--green-dark);
  background: transparent;
}

button[disabled] {
  cursor: not-allowed;
  opacity: 0.55;
}

.section-grid {
  margin-top: 26px;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 20px;
}

.panel {
  grid-column: span 12;
  padding: clamp(20px, 3vw, 30px);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius);
  background: rgba(255, 253, 247, 0.9);
  box-shadow: 0 12px 36px rgba(16, 38, 31, 0.06);
}

.panel.half {
  grid-column: span 6;
}

.panel.third {
  grid-column: span 4;
}

.panel.two-thirds {
  grid-column: span 8;
}

.panel-header,
.page-heading,
.action-row,
.record-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.panel-header {
  margin-bottom: 20px;
}

.panel-header p,
.muted,
.record-row small,
.help-text {
  color: var(--ink-soft);
}

.page-heading {
  padding: 32px 2px 24px;
  align-items: flex-end;
}

.page-heading h1 {
  font-size: clamp(2.5rem, 5vw, 4.8rem);
}

.page-heading p {
  max-width: 520px;
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.55;
}

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

.stat-card {
  padding: 20px;
  border-radius: 19px;
  background: #edf4ef;
  border: 1px solid rgba(8, 166, 108, 0.12);
}

.stat-card:nth-child(2n) {
  background: #f7ecd5;
  border-color: rgba(216, 163, 43, 0.14);
}

.stat-card strong {
  display: block;
  font-family: Georgia, serif;
  font-size: 2.25rem;
  line-height: 1;
}

.stat-card span {
  display: block;
  margin-top: 8px;
  color: var(--ink-soft);
  font-size: 0.8rem;
  font-weight: 750;
}

.account-card {
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 15px;
  border-radius: 18px;
  background: var(--ink);
  color: white;
}

.avatar {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--ink);
  background: var(--mint);
  font-family: Georgia, serif;
  font-size: 1.35rem;
  font-weight: 800;
}

.account-card small,
.account-card p {
  color: rgba(255, 255, 255, 0.68);
}

.account-card strong,
.account-card small {
  display: block;
}

.action-row {
  margin-top: 18px;
  justify-content: flex-start;
  flex-wrap: wrap;
}

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

.form-grid .full {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 0.8rem;
  font-weight: 780;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 12px 13px;
  color: var(--ink);
  background: white;
}

textarea {
  min-height: 110px;
  resize: vertical;
}

.share-result,
.credential-box,
.notice {
  margin-top: 16px;
  padding: 15px;
  border-radius: 15px;
  word-break: break-word;
}

.share-result,
.credential-box {
  background: #e7f5ee;
  border: 1px solid rgba(8, 166, 108, 0.2);
}

.credential-box code,
.share-result code {
  font-size: 0.78rem;
}

.notice {
  color: #69521f;
  background: #fff3d6;
  border: 1px solid rgba(216, 163, 43, 0.28);
}

.notice.error {
  color: #762d27;
  background: #fbe8e4;
  border-color: rgba(183, 69, 57, 0.25);
}

.notice.success {
  color: #075f41;
  background: #e1f5ea;
  border-color: rgba(8, 166, 108, 0.24);
}

.record-list {
  display: grid;
  gap: 10px;
}

.record-row {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: white;
}

.record-row > div {
  min-width: 0;
}

.record-row strong,
.record-row small {
  display: block;
}

.record-row small {
  margin-top: 4px;
}

.status-chip,
.tag {
  padding: 6px 9px;
  color: var(--ink-soft);
  background: #edf0ed;
}

.status-chip.active,
.status-chip.issued,
.status-chip.qualified {
  color: #066343;
  background: #dff5e9;
}

.status-chip.redeemed {
  color: #654d12;
  background: #faedc8;
}

.status-chip.reversed,
.status-chip.suspended,
.status-chip.rejected {
  color: #812f27;
  background: #f9e1de;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

th,
td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--ink-soft);
  font-size: 0.7rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.tabs {
  margin: 12px 0 20px;
  padding: 6px;
  display: flex;
  gap: 5px;
  overflow-x: auto;
  border-radius: 16px;
  background: rgba(16, 38, 31, 0.08);
}

.tabs button {
  min-height: 42px;
  padding: 8px 14px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 11px;
  color: var(--ink-soft);
  background: transparent;
  cursor: pointer;
  font-weight: 800;
}

.tabs button.active {
  color: white;
  background: var(--ink);
}

.relationship-lane {
  display: grid;
  gap: 10px;
}

.relationship-edge {
  margin-left: calc(var(--depth, 1) * 18px);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-left: 4px solid var(--green);
  border-radius: 0 14px 14px 0;
  background: #edf4ef;
}

.relationship-arrow {
  color: var(--green-dark);
  font-weight: 900;
}

.empty-state {
  min-height: 170px;
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
  color: var(--ink-soft);
}

.empty-state strong {
  color: var(--ink);
}

.login-layout {
  min-height: 620px;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  overflow: hidden;
  border-radius: 34px;
  background: var(--paper-strong);
  box-shadow: var(--shadow);
}

.login-story {
  padding: clamp(32px, 6vw, 72px);
  color: white;
  background: var(--ink);
  position: relative;
  overflow: hidden;
}

.login-story::after {
  content: "";
  width: 320px;
  height: 320px;
  border-radius: 50%;
  position: absolute;
  right: -100px;
  bottom: -100px;
  background: rgba(8, 166, 108, 0.34);
}

.login-story h1 {
  max-width: 600px;
  margin: 18px 0;
  font-family: Georgia, serif;
  font-size: clamp(2.8rem, 6vw, 5.4rem);
  font-weight: 500;
  line-height: 0.98;
  letter-spacing: -0.045em;
}

.login-story p {
  max-width: 520px;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.7;
}

.login-form {
  padding: clamp(28px, 5vw, 64px);
  display: grid;
  align-content: center;
}

.login-form form {
  display: grid;
  gap: 14px;
}

.login-form .primary-button {
  margin-top: 6px;
}

.local-credentials {
  margin-top: 20px;
  padding: 14px;
  border-radius: 14px;
  background: #eef4ef;
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.site-footer {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto 28px;
  padding-top: 18px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.76rem;
}

.site-footer p {
  margin: 0;
}

.toast-region {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  display: grid;
  gap: 10px;
}

.toast {
  max-width: min(420px, calc(100vw - 40px));
  padding: 14px 16px;
  border-radius: 14px;
  color: white;
  background: var(--ink);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.24);
  animation: toast-in 0.25s ease;
}

.toast.error {
  background: var(--red);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

@media (max-width: 900px) {
  .mode-pill {
    display: none;
  }

  .topbar {
    gap: 10px;
  }

  .brand {
    min-width: 0;
  }

  .brand small {
    display: none;
  }

  .hero,
  .login-layout {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: unset;
  }

  .panel.half,
  .panel.third,
  .panel.two-thirds {
    grid-column: span 12;
  }

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

@media (max-width: 620px) {
  .topbar {
    width: calc(100% - 20px);
    margin-top: 10px;
    padding: 8px;
    border-radius: 18px;
  }

  .brand strong {
    display: none;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
  }

  .primary-nav {
    justify-content: flex-end;
  }

  .primary-nav button {
    padding: 9px 10px;
    font-size: 0.78rem;
  }

  main {
    width: calc(100% - 20px);
    margin-top: 18px;
  }

  .hero {
    padding: 28px 20px;
    border-radius: 26px;
  }

  .hero h1 {
    font-size: 3rem;
  }

  .hero-card {
    padding: 20px;
  }

  .identity-grid,
  .form-grid,
  .stat-grid {
    grid-template-columns: 1fr;
  }

  .page-heading,
  .panel-header,
  .record-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .site-footer {
    width: calc(100% - 20px);
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
