@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=Space+Grotesk:wght@500;600;700&display=swap');

:root {
  --ui-bg-a: #f7f5ef;
  --ui-bg-b: #ece7dd;
  --ui-paper: #fffdf8;
  --ui-panel: rgba(255, 253, 248, 0.86);
  --ui-ink: #171717;
  --ui-muted: #6d675d;
  --ui-line: #d9d0c2;
  --ui-line-soft: #e8e1d5;
  --ui-brand: #181818;
  --ui-brand-soft: #f0ebe2;
  --ui-accent: #2e6f61;
  --ui-danger: #b94040;
  --ui-success: #245d4f;
  --ui-shadow: 0 20px 46px rgba(36, 30, 19, 0.10);
  --ui-radius-lg: 28px;
  --ui-radius-md: 18px;
  --ui-radius-sm: 12px;
  --ui-max: 1180px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  color: var(--ui-ink);
  background:
    radial-gradient(900px 520px at 0% -10%, rgba(46, 111, 97, 0.10), transparent 42%),
    radial-gradient(860px 560px at 100% 0%, rgba(36, 93, 79, 0.08), transparent 46%),
    linear-gradient(180deg, var(--ui-bg-a), var(--ui-bg-b));
}
a { color: inherit; }
img { max-width: 100%; }

.shell,
.link-page {
  width: min(100%, var(--ui-max));
  margin: 0 auto;
  padding: 20px 16px 28px;
}

.topbar {
  width: min(100%, var(--ui-max));
  margin: 0 auto;
  padding: 16px;
}

.topbar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  border-radius: 24px;
  background: rgba(25, 24, 21, 0.92);
  color: #f5f1e8;
  box-shadow: 0 20px 45px rgba(16, 13, 10, 0.18);
}

.brand { display: grid; gap: 4px; min-width: 0; }
.brand-title {
  margin: 0;
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
  font-size: clamp(1.45rem, 4vw, 2.2rem);
  line-height: 0.98;
  letter-spacing: -0.03em;
}
.brand-subtitle { margin: 0; color: rgba(245, 241, 232, 0.72); font-size: 0.95rem; }

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.9fr);
  gap: 18px;
  margin-bottom: 18px;
}

.hero-panel,
.card,
.auth-card,
.expired-card {
  background: var(--ui-panel);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: var(--ui-radius-lg);
  box-shadow: var(--ui-shadow);
}

.hero-panel { padding: 26px; }
.hero-kicker,
.eyebrow {
  margin: 0 0 10px;
  color: var(--ui-muted);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero-title,
.auth-title,
.card-title {
  margin: 0;
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
  line-height: 0.96;
  letter-spacing: -0.04em;
}

.hero-title { font-size: clamp(2.3rem, 5vw, 4.4rem); }
.auth-title { font-size: clamp(2rem, 5vw, 3rem); }
.card-title { font-size: clamp(1.45rem, 3vw, 2rem); line-height: 1; }

.hero-copy,
.auth-copy,
.card-copy,
.muted {
  margin: 0;
  color: var(--ui-muted);
  line-height: 1.55;
}

.hero-aside {
  padding: 22px;
  display: grid;
  align-content: space-between;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.7), rgba(255,255,255,0.92)),
    radial-gradient(circle at top left, rgba(46,111,97,0.12), transparent 42%);
}

.hero-stat { display: grid; gap: 6px; }
.hero-stat-label {
  color: var(--ui-muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.hero-stat-value {
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
  font-size: clamp(1.6rem, 4vw, 2.8rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
}
.hero-note {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--ui-line-soft);
  color: var(--ui-muted);
  line-height: 1.5;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: 18px;
}

.card { padding: 22px; }
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 18px;
}

.pill,
.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--ui-brand-soft);
  color: var(--ui-ink);
  font-size: 0.84rem;
  font-weight: 600;
}

.field { display: grid; gap: 8px; margin-top: 16px; }
.field-label { font-size: 0.95rem; font-weight: 700; }

input,
select,
textarea,
button,
.button-link {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  min-height: 52px;
  padding: 13px 15px;
  border-radius: 16px;
  border: 1px solid var(--ui-line);
  background: rgba(255, 252, 246, 0.96);
  color: var(--ui-ink);
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}

input::placeholder,
textarea::placeholder { color: #9a9387; }
input:focus,
select:focus,
textarea:focus {
  border-color: #8f8472;
  box-shadow: 0 0 0 4px rgba(36, 93, 79, 0.10);
}

button,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 50px;
  padding: 12px 18px;
  border: 0;
  border-radius: 16px;
  background: var(--ui-brand);
  color: #fffdf8;
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
}

button:disabled,
.is-disabled { opacity: 0.55; cursor: not-allowed; }

.button-secondary {
  background: var(--ui-brand-soft);
  color: var(--ui-ink);
  border: 1px solid rgba(0,0,0,0.06);
}

.button-success { background: var(--ui-success); }
.button-ghost {
  background: rgba(255,255,255,0.08);
  color: #f5f1e8;
  border: 1px solid rgba(255,255,255,0.18);
}

.button-row,
.wallet-actions,
.table-actions,
.info-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.children-list { margin-top: 16px; display: grid; gap: 10px; }
.group-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}
.group-button {
  min-height: 58px;
  justify-content: flex-start;
  text-align: left;
}
.group-button.is-active {
  background: var(--ui-brand);
  color: #fffdf8;
}
.child-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--ui-line-soft);
  border-radius: 18px;
  background: rgba(255,255,255,0.62);
}
.child-name { font-weight: 700; }
.child-meta { margin-top: 4px; color: var(--ui-muted); font-size: 0.94rem; }

.result-box { display: grid; gap: 16px; }
.result-link {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255,255,255,0.68);
  border: 1px solid var(--ui-line-soft);
  word-break: break-word;
}
.result-link a { color: #204f45; font-weight: 600; }
.result-link.is-hidden {
  display: none;
}

.qr-panel {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 18px;
  border-radius: 22px;
  border: 1px dashed var(--ui-line);
  background: rgba(255,255,255,0.44);
}

.qr-image {
  display: block;
  width: min(100%, 320px);
  aspect-ratio: 1 / 1;
  padding: 12px;
  border-radius: 24px;
  background: #fff;
  border: 1px solid var(--ui-line-soft);
  box-shadow: 0 12px 26px rgba(25, 20, 13, 0.08);
}
.qr-link {
  display: inline-flex;
  text-decoration: none;
}
.qr-panel.is-hidden {
  display: none;
}

.table-wrap {
  overflow: auto;
  border-radius: 20px;
  border: 1px solid var(--ui-line-soft);
  background: rgba(255,255,255,0.56);
}
table { width: 100%; border-collapse: collapse; }
th, td {
  padding: 14px 16px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--ui-line-soft);
}
th {
  position: sticky;
  top: 0;
  background: rgba(247, 243, 235, 0.98);
  color: var(--ui-muted);
  font-size: 0.84rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
tbody tr:last-child td { border-bottom: none; }
.checkbox-cell { width: 88px; text-align: center; }
.checkbox-cell input {
  width: auto;
  min-height: 0;
  transform: scale(1.18);
}

.table-actions {
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.auth-card,
.expired-card {
  width: min(100%, 470px);
  padding: 28px;
}

.notice,
.error-box {
  margin-top: 14px;
  padding: 13px 14px;
  border-radius: 16px;
  font-size: 0.95rem;
  line-height: 1.45;
}
.notice {
  background: rgba(36,93,79,0.08);
  border: 1px solid rgba(36,93,79,0.14);
  color: #224d44;
}
.error-box {
  background: rgba(185,64,64,0.08);
  border: 1px solid rgba(185,64,64,0.16);
  color: #8d3333;
}

.expired-card { width: min(100%, 620px); }
.inline { margin: 0; }

@media (max-width: 980px) {
  .hero,
  .grid { grid-template-columns: 1fr; }
  .topbar-inner { align-items: flex-start; flex-direction: column; }
  .topbar-actions { width: 100%; justify-content: stretch; }
  .topbar-actions .button-link,
  .topbar-actions button { flex: 1 1 180px; }
}

@media (max-width: 720px) {
  .shell,
  .link-page,
  .topbar { padding-left: 12px; padding-right: 12px; }
  .hero-panel,
  .hero-aside,
  .card,
  .auth-card,
  .expired-card { padding: 18px; border-radius: 22px; }
  .child-row { grid-template-columns: 1fr; }
  .button-row,
  .wallet-actions,
  .table-actions { flex-direction: column; align-items: stretch; }
  .qr-image { width: min(100%, 280px); }
}
