:root {
  --teal-bg: #0f8b86;
  --teal-bg-deep: #0a6b67;
  --teal: #14b8a6;
  --teal-strong: #0d9488;
  --teal-soft: #ccfbf1;
  --teal-ink: #134e4a;
  --navy: #102a43;
  --navy-soft: #1b3a5c;
  --navy-line: #25405f;
  --card: #ffffff;
  --ink: #0f2233;
  --ink-soft: #4a5e72;
  --ink-faint: #8499ab;
  --line: #e6edf2;
  --line-soft: #f1f5f8;
  --danger: #b4453a;
  --radius-xl: 26px;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-pill: 999px;
  --shadow-panel: 0 30px 70px -28px rgba(8, 30, 40, 0.55), 0 8px 24px -12px rgba(8, 30, 40, 0.35);
  --shadow-card: 0 14px 34px -20px rgba(16, 42, 67, 0.4);
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, "Apple Color Emoji", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background:
    radial-gradient(1100px 700px at 12% -8%, rgba(255, 255, 255, 0.22), transparent 60%),
    radial-gradient(900px 600px at 100% 110%, rgba(4, 50, 48, 0.55), transparent 55%),
    linear-gradient(160deg, var(--teal-bg) 0%, var(--teal-bg-deep) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 32px 20px;
}

#app { width: 100%; max-width: 560px; }

/* ---- boot dots ---- */
.boot { display: flex; gap: 8px; justify-content: center; padding: 60px 0; }
.boot-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  animation: bounce 1.1s infinite ease-in-out;
}
.boot-dot:nth-child(2) { animation-delay: 0.15s; }
.boot-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.45; }
  40% { transform: translateY(-7px); opacity: 1; }
}

/* ---- shared reveal ---- */
.reveal { animation: rise 0.55s cubic-bezier(0.21, 0.78, 0.31, 1) both; }
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---- panel (dark navy) ---- */
.panel {
  background:
    radial-gradient(120% 100% at 0% 0%, var(--navy-soft), var(--navy) 62%);
  border-radius: var(--radius-xl);
  padding: 14px;
  box-shadow: var(--shadow-panel);
  border: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 64px);
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px 16px;
  color: #eaf3f4;
  flex: none;
}
.brand-mark {
  width: 30px; height: 30px; flex: none;
  border-radius: 9px;
  background: linear-gradient(140deg, var(--teal) 0%, var(--teal-strong) 100%);
  display: grid; place-items: center;
  box-shadow: 0 6px 16px -6px rgba(20, 184, 166, 0.8);
}
.brand-mark svg { width: 17px; height: 17px; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text b { font-size: 14px; font-weight: 550; letter-spacing: 0.2px; }
.brand-text span { font-size: 11px; color: #8fb6b8; letter-spacing: 0.4px; }
.conn-pill {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.3px;
  color: var(--teal-soft);
  background: rgba(20, 184, 166, 0.14);
  border: 1px solid rgba(20, 184, 166, 0.3);
  padding: 4px 10px; border-radius: var(--radius-pill);
}
.conn-pill::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: #2ee6c8; box-shadow: 0 0 0 3px rgba(46, 230, 200, 0.22);
}

/* ---- white card ---- */
.card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 26px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

/* ---- signed-out ---- */
.signin { text-align: center; padding: 14px 22px 26px; }
.signin .lock {
  width: 54px; height: 54px; margin: 0 auto 18px;
  border-radius: 16px;
  background: var(--teal-soft);
  color: var(--teal-strong);
  display: grid; place-items: center;
}
.signin .lock svg { width: 26px; height: 26px; }
.signin h1 { font-size: 21px; margin: 0 0 8px; letter-spacing: -0.2px; }
.signin p { margin: 0 auto 22px; color: var(--ink-soft); font-size: 14px; max-width: 340px; line-height: 1.55; }

/* ---- buttons ---- */
.btn {
  font: inherit; cursor: pointer; border: none;
  border-radius: var(--radius-md);
  padding: 12px 20px; font-size: 14px; font-weight: 500;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  transition: transform 0.12s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  color: #052b28;
  background: linear-gradient(140deg, var(--teal) 0%, var(--teal-strong) 100%);
  box-shadow: 0 10px 22px -10px rgba(13, 148, 136, 0.8);
}
.btn-primary:hover { box-shadow: 0 14px 26px -10px rgba(13, 148, 136, 0.9); }
.btn-primary svg { width: 17px; height: 17px; }
.btn-ghost {
  color: var(--ink-soft);
  background: var(--line-soft);
  border: 1px solid var(--line);
  padding: 9px 16px; font-size: 13px;
}
.btn-ghost:hover { background: #e9eff3; color: var(--ink); }
.btn-ghost svg { width: 15px; height: 15px; }
.btn-block { width: 100%; }

/* ---- signed-in identity header ---- */
.id-head { display: flex; align-items: center; gap: 15px; margin-bottom: 22px; }
.avatar {
  width: 52px; height: 52px; flex: none;
  border-radius: 15px;
  background: linear-gradient(145deg, var(--navy-soft), var(--navy));
  color: #fff;
  display: grid; place-items: center;
  font-size: 19px; font-weight: 600; letter-spacing: 0.5px;
  box-shadow: var(--shadow-card);
}
.id-meta { min-width: 0; }
.id-meta .name { font-size: 19px; font-weight: 550; letter-spacing: -0.2px; }
.id-meta .email { font-size: 13.5px; color: var(--ink-soft); margin-top: 1px; word-break: break-all; }
.id-meta .sub {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 7px;
  font-family: var(--mono); font-size: 11.5px; color: var(--teal-ink);
  background: var(--teal-soft); border-radius: var(--radius-pill);
  padding: 3px 10px; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
.id-meta .sub b { font-family: var(--sans); font-weight: 600; opacity: 0.7; }

/* ---- sections ---- */
.section { margin-top: 22px; }
.section-label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.6px; text-transform: uppercase;
  color: var(--ink-faint); margin-bottom: 11px;
  display: flex; align-items: center; gap: 8px;
}
.section-label .from {
  font-weight: 600; letter-spacing: 0.3px; text-transform: none;
  color: var(--teal-strong);
  background: var(--teal-soft); border-radius: var(--radius-pill);
  padding: 2px 8px; font-size: 10px;
}

/* ---- chips ---- */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 500; letter-spacing: 0.2px;
  border-radius: var(--radius-pill);
  padding: 6px 13px;
}
.chip-role { color: #044f48; background: var(--teal-soft); border: 1px solid #9bead9; }
.chip-group { color: #1b3a5c; background: #e8f0f8; border: 1px solid #cfe0ef; }
.chip-scope { color: #5a4a17; background: #fbf2d8; border: 1px solid #ecdca8; }
.chip-none { color: var(--ink-faint); background: var(--line-soft); border: 1px dashed var(--line); font-weight: 500; }
.chip .dot { width: 6px; height: 6px; border-radius: 50%; opacity: 0.85; }
.chip-role .dot { background: var(--teal-strong); }
.chip-group .dot { background: #4a7bb0; }
.chip-scope .dot { background: #c2a23c; }

/* ---- claims key/value ---- */
.claims {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.claim-row {
  display: grid; grid-template-columns: 132px 1fr; gap: 14px;
  padding: 10px 14px; align-items: baseline;
  border-top: 1px solid var(--line-soft);
}
.claim-row:first-child { border-top: none; }
.claim-row:nth-child(odd) { background: #fbfdfe; }
.claim-k {
  font-size: 12px; font-weight: 500; color: var(--ink-soft);
  letter-spacing: 0.2px;
}
.claim-v {
  font-family: var(--mono); font-size: 12.5px; color: var(--ink);
  word-break: break-word; line-height: 1.5;
}
.claim-v .hint { display: block; font-family: var(--sans); font-size: 11px; color: var(--ink-faint); margin-top: 2px; }

/* ---- footer ---- */
.card-foot {
  margin-top: 24px; padding-top: 18px;
  border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-foot .tok-note { font-size: 11.5px; color: var(--ink-faint); }

/* ---- error ---- */
.err {
  text-align: center; padding: 14px 20px 24px;
}
.err .badge {
  width: 50px; height: 50px; margin: 0 auto 16px; border-radius: 14px;
  background: #fbe9e7; color: var(--danger); display: grid; place-items: center;
}
.err .badge svg { width: 24px; height: 24px; }
.err h1 { font-size: 19px; margin: 0 0 8px; }
.err p { color: var(--ink-soft); font-size: 13.5px; margin: 0 auto 20px; max-width: 360px; line-height: 1.55; }
.err .detail {
  font-family: var(--mono); font-size: 11.5px; color: var(--danger);
  background: #fdf3f2; border: 1px solid #f4d7d3; border-radius: var(--radius-md);
  padding: 9px 12px; margin: 0 auto 20px; max-width: 100%; word-break: break-word; text-align: left;
}

.foot-note {
  text-align: center; margin-top: 16px; font-size: 11.5px;
  color: rgba(255, 255, 255, 0.7); letter-spacing: 0.3px;
}

@media (max-width: 480px) {
  .card { padding: 20px; }
  .claim-row { grid-template-columns: 1fr; gap: 2px; }
  .claim-k { color: var(--ink-faint); }
}
