/* ================================================================
   emajiwallet — Design System
   Tokens on body (global). Components scoped to .emaji-page.
   Tab bar uses .e-tabbar / .e-tab (global, outside .emaji-page).
   ================================================================ */

/* ── Tokens ─────────────────────────────────────────────────────── */
body {
  --brand:       #0f766e;
  --brand-text:  #0f766e;
  --brand-deep:  linear-gradient(152deg,
                   color-mix(in srgb, #0f766e 94%, #0c0c14),
                   color-mix(in srgb, #0f766e 42%, #120c1c));
  --font-display: 'Bricolage Grotesque', -apple-system, sans-serif;
  --font-ui:      'Hanken Grotesk', -apple-system, system-ui, sans-serif;
  /* light theme */
  --canvas:    #F1ECE2;
  --surface:   #FFFFFF;
  --surface-2: #F3EFE7;
  --ink:       #1B1A28;
  --ink-2:     #595769;
  --ink-3:     #9A97A8;
  --line:      #E8E2D6;
  --accent:    #df6238;
  --accent-deep: #b3471f;
  --ready:     #1f8a5b;
  --likely:    #3563c9;
  --missing:   #c47d1a;
  --idle:      #94909f;
  --shadow-a1: .05; --shadow-a2: .04; --shadow-a3: .07; --shadow-a4: .13;
  --shadow-sm: 0 1px 2px rgba(20,18,33,var(--shadow-a1)),
               0 1px 3px rgba(20,18,33,var(--shadow-a2));
  --shadow-md: 0 6px 18px rgba(20,18,33,var(--shadow-a3)),
               0 2px 6px rgba(20,18,33,var(--shadow-a2));
  --shadow-lg: 0 20px 48px rgba(20,18,33,var(--shadow-a4)),
               0 6px 16px rgba(20,18,33,var(--shadow-a3));

  background: var(--canvas);
  font-family: var(--font-ui);
  color: var(--ink);
}

body.dark {
  --canvas:    #121120;
  --surface:   #1D1C2B;
  --surface-2: #272639;
  --ink:       #F3F1F9;
  --ink-2:     #B0ADC0;
  --ink-3:     #726F84;
  --line:      rgba(255,255,255,0.085);
  --brand-text: color-mix(in srgb, var(--brand) 58%, white);
  --accent:    #ef8157;
  --accent-deep: #ef8157;
  --ready:     #36b97e;
  --likely:    #7196ec;
  --missing:   #e0a64a;
  --idle:      #6c697b;
  --shadow-a1: .3; --shadow-a2: .25; --shadow-a3: .4; --shadow-a4: .6;
}

/* derived tints (auto from brand + surface) */
body {
  --brand-tint:        color-mix(in srgb, var(--brand) 14%, var(--surface));
  --brand-tint-strong: color-mix(in srgb, var(--brand) 22%, var(--surface));
}

/* ── Tab bar (global — outside .emaji-page) ─────────────────────── */
.e-tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  padding: 8px 10px max(26px, env(safe-area-inset-bottom, 26px));
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(18px) saturate(170%);
  -webkit-backdrop-filter: blur(18px) saturate(170%);
  border-top: 1px solid var(--line);
}

.e-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding-top: 4px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink-3);
  font-family: var(--font-ui);
  text-decoration: none;
  transition: color .18s ease;
  position: relative;
}
.e-tab span {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.e-tab .e-tabico {
  font-size: 22px;
  transition: transform .18s cubic-bezier(.2,.7,.2,1);
  line-height: 1;
}
.e-tab.on {
  color: var(--brand-text);
}
.e-tab.on .e-tabico {
  transform: translateY(-1px);
}
.e-tab-dot {
  position: absolute;
  top: 4px; right: 18%;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--surface);
}

/* space for fixed tab bar */
body.has-e-tabbar { padding-bottom: 0; }
.has-e-tabbar .emaji-page { padding-bottom: 100px; }

/* Hide the old ios-tab-bar (replaced by .e-tabbar) */
.ios-tab-bar { display: none !important; }

/* ── Page scaffold ──────────────────────────────────────────────── */
.emaji-page {
  min-height: 100vh;
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.45;
  letter-spacing: -0.01em;
  color: var(--ink);
  box-sizing: border-box;
  padding: 20px 18px 100px;
  animation: e-pageIn .38s cubic-bezier(.2,.7,.2,1) both;
}
@keyframes e-pageIn {
  from { opacity: .6; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .emaji-page { animation: none; }
}

/* ── Typography helpers ─────────────────────────────────────────── */
.emaji-page .e-display {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.025em;
}
.emaji-page .e-eyebrow {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: .02em;
  text-transform: uppercase;
}

/* ── Top bar ────────────────────────────────────────────────────── */
.emaji-page .e-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.emaji-page .e-topbar-titles { flex: 1; min-width: 0; }
.emaji-page .e-topbar-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 30px;
  line-height: 1.04;
  letter-spacing: -0.025em;
}

/* ── Icon button ────────────────────────────────────────────────── */
.emaji-page .e-iconbtn {
  width: 42px; height: 42px;
  border-radius: 13px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  text-decoration: none;
  transition: transform .12s ease;
  font-size: 20px;
}
.emaji-page .e-iconbtn:active { transform: scale(.94); color: var(--ink); }
.emaji-page .e-iconbtn:hover { color: var(--ink); }

/* ── Cards ──────────────────────────────────────────────────────── */
.emaji-page .e-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow-sm);
}
.emaji-page .e-card-pad { padding: 18px; }
.emaji-page .e-tap {
  cursor: pointer;
  transition: transform .14s cubic-bezier(.2,.7,.2,1);
  text-decoration: none;
  display: block;
}
.emaji-page .e-tap:active { transform: scale(.985); }

/* ── Stack / Row ────────────────────────────────────────────────── */
.emaji-page .e-stack { display: flex; flex-direction: column; gap: 12px; }
.emaji-page .e-row   { display: flex; align-items: center; gap: 12px; }
.emaji-page .e-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.emaji-page .e-grid3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }

/* ── Section header ─────────────────────────────────────────────── */
.emaji-page .e-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin: 26px 2px 12px;
}
.emaji-page .e-section-title {
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.02em;
}
.emaji-page .e-section-link {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--brand-text);
  cursor: pointer;
  flex-shrink: 0;
  text-decoration: none;
}
.emaji-page .e-section-sub {
  font-size: 13px;
  color: var(--ink-3);
  flex-shrink: 0;
}

/* ── Hero panel ─────────────────────────────────────────────────── */
.emaji-page .e-hero {
  position: relative;
  overflow: hidden;
  border-radius: 26px;
  padding: 20px;
  background: var(--brand-deep);
  color: #fff;
  box-shadow: var(--shadow-md);
}
.emaji-page .e-hero::after {
  content: "";
  position: absolute; inset: 0;
  opacity: .5; pointer-events: none;
  background-image:
    repeating-linear-gradient(115deg, transparent 0 11px, rgba(255,255,255,.045) 11px 12px),
    radial-gradient(120% 120% at 88% -10%, rgba(255,255,255,.18), transparent 55%);
}
.emaji-page .e-hero > * { position: relative; z-index: 1; }

/* ── Buttons ────────────────────────────────────────────────────── */
.emaji-page .e-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 50px; padding: 0 20px; border-radius: 15px; border: none; cursor: pointer;
  font-family: var(--font-ui); font-weight: 650; font-size: 15.5px;
  letter-spacing: -0.01em; white-space: nowrap;
  width: 100%;
  transition: transform .12s ease, filter .15s ease;
  text-decoration: none;
}
.emaji-page .e-btn:active { transform: scale(.975); }
.emaji-page .e-btn-primary {
  background: var(--brand); color: #fff;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--brand) 35%, transparent);
}
.emaji-page .e-btn-primary:active { filter: brightness(.96); color: #fff; }
.emaji-page .e-btn-primary:hover { color: #fff; }
.emaji-page .e-btn-soft {
  background: var(--brand-tint); color: var(--brand-text);
}
.emaji-page .e-btn-soft:hover { color: var(--brand-text); }
.emaji-page .e-btn-ghost {
  background: var(--surface-2); color: var(--ink); border: 1px solid var(--line);
}
.emaji-page .e-btn-ghost:hover { color: var(--ink); }
.emaji-page .e-btn-sm {
  height: 40px; padding: 0 15px; font-size: 14px; border-radius: 12px; width: auto;
}
.emaji-page .e-btn-danger { color: var(--missing); }

/* ── Chips ──────────────────────────────────────────────────────── */
.emaji-page .e-chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 12px; border-radius: 9px;
  font-size: 12.5px; font-weight: 600; white-space: nowrap;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line);
}
.emaji-page .e-chip-brand {
  background: var(--brand-tint); color: var(--brand-text); border-color: transparent;
}
.emaji-page .e-chip-sm {
  height: 24px; padding: 0 9px; font-size: 11.5px; border-radius: 7px;
}

/* ── Status badges ──────────────────────────────────────────────── */
.emaji-page .e-badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 10px; border-radius: 8px;
  font-size: 12px; font-weight: 650; letter-spacing: -0.01em; white-space: nowrap;
}
.emaji-page .e-statusdot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.emaji-page .e-badge-ready   { background: color-mix(in srgb,var(--ready) 16%,var(--surface));   color: var(--ready); }
.emaji-page .e-badge-likely  { background: color-mix(in srgb,var(--likely) 16%,var(--surface));  color: var(--likely); }
.emaji-page .e-badge-missing { background: color-mix(in srgb,var(--missing) 18%,var(--surface)); color: var(--missing); }
.emaji-page .e-badge-idle    { background: var(--surface-2); color: var(--ink-3); }
.emaji-page .e-badge-verified { background: color-mix(in srgb,var(--ready) 16%,var(--surface)); color: var(--ready); }

/* ── Progress ring ──────────────────────────────────────────────── */
.emaji-page .e-ring-wrap {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.emaji-page .e-ring-label {
  position: absolute;
  display: flex; flex-direction: column; align-items: center;
  line-height: 1; pointer-events: none;
}
.emaji-page .e-ring-pct {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.03em;
}
.emaji-page .e-ring-sub {
  font-size: 10px; color: var(--ink-3); font-weight: 600; margin-top: 2px;
}

/* ── Pass card (credential as passport) ─────────────────────────── */
.emaji-page .e-pass {
  position: relative; overflow: hidden; border-radius: 20px; padding: 16px;
  color: #fff; box-shadow: var(--shadow-md);
  background: var(--passbg, linear-gradient(150deg,#1c7a6e,#0b3f3a));
  cursor: pointer;
  transition: transform .14s cubic-bezier(.2,.7,.2,1);
}
.emaji-page .e-pass:active { transform: scale(.985); }
.emaji-page .e-pass::after {
  content: ""; position: absolute; inset: 0; z-index: 0; opacity: .85; pointer-events: none;
  background-image:
    repeating-radial-gradient(circle at 86% 18%, rgba(255,255,255,.08) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(58deg, transparent 0 9px, rgba(255,255,255,.045) 9px 10px);
}
.emaji-page .e-pass > * { position: relative; z-index: 1; }
.emaji-page .e-pass-issuer {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 600; opacity: .92;
}
.emaji-page .e-pass-logo {
  width: 26px; height: 26px; border-radius: 7px;
  background: rgba(255,255,255,.16);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 13px;
  flex-shrink: 0;
}
.emaji-page .e-pass-name {
  font-family: var(--font-display); font-weight: 700;
  font-size: 19px; line-height: 1.1; letter-spacing: -0.02em; margin-top: 14px;
}
.emaji-page .e-pass-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 16px; font-size: 11.5px;
}
.emaji-page .e-seal {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.4);
  font-size: 14px;
}

/* ── Grouped list rows ──────────────────────────────────────────── */
.emaji-page .e-grp {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 18px; overflow: hidden; box-shadow: var(--shadow-sm);
}
.emaji-page .e-lrow {
  display: flex; align-items: center; gap: 13px;
  padding: 13px 16px; position: relative;
  cursor: pointer;
  transition: background .14s ease;
  text-decoration: none; color: inherit;
}
.emaji-page .e-lrow:not(:last-child)::after {
  content: ""; position: absolute; left: 53px; right: 0; bottom: 0;
  height: 1px; background: var(--line);
}
.emaji-page .e-lrow:active { background: var(--surface-2); }
.emaji-page .e-lrow-ico {
  width: 34px; height: 34px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  background: var(--brand-tint); color: var(--brand-text); font-size: 17px;
}
.emaji-page .e-lrow-body { flex: 1; min-width: 0; }
.emaji-page .e-lrow-title { font-weight: 600; font-size: 14.5px; }
.emaji-page .e-lrow-sub {
  font-size: 12.5px; color: var(--ink-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.emaji-page .e-lrow-detail { font-size: 13.5px; color: var(--ink-3); }

/* ── Search ─────────────────────────────────────────────────────── */
.emaji-page .e-search {
  display: flex; align-items: center; gap: 10px;
  height: 46px; padding: 0 14px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-sm); color: var(--ink-3);
}
.emaji-page .e-search input {
  border: none; outline: none; background: transparent;
  font: inherit; color: var(--ink); width: 100%;
  font-family: var(--font-ui);
}
.emaji-page .e-search input::placeholder { color: var(--ink-3); }

/* ── Segmented control ──────────────────────────────────────────── */
.emaji-page .e-seg {
  display: flex; gap: 4px; padding: 4px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 14px;
}
.emaji-page .e-seg button {
  flex: 1; height: 36px; border: none; background: transparent;
  border-radius: 10px; font: inherit; font-weight: 600; font-size: 13.5px;
  color: var(--ink-2); cursor: pointer;
  transition: all .18s ease;
  font-family: var(--font-ui);
}
.emaji-page .e-seg button.on {
  background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-sm);
}

/* ── Stat tiles ─────────────────────────────────────────────────── */
.emaji-page .e-stat {
  padding: 14px; border-radius: 18px;
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  text-decoration: none; display: block; color: inherit;
  transition: transform .14s ease;
}
.emaji-page .e-stat:active { transform: scale(.98); color: inherit; }
.emaji-page .e-stat-n {
  font-family: var(--font-display); font-weight: 700; font-size: 26px;
  line-height: 1; letter-spacing: -0.03em;
}
.emaji-page .e-stat-l {
  font-size: 11.5px; color: var(--ink-3); font-weight: 600; margin-top: 5px;
}

/* ── Notification card ──────────────────────────────────────────── */
.emaji-page .e-notif {
  position: relative; overflow: hidden; border-radius: 22px; padding: 16px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  background: color-mix(in srgb, var(--accent) 9%, var(--surface));
}
.emaji-page .e-notif-tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .03em;
  text-transform: uppercase; color: var(--accent-deep); white-space: nowrap;
}

/* ── Org mark ───────────────────────────────────────────────────── */
.emaji-page .e-orgmark {
  border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; color: #fff;
  flex-shrink: 0;
}

/* ── Pbar ───────────────────────────────────────────────────────── */
.emaji-page .e-pbar {
  height: 8px; border-radius: 99px;
  background: var(--surface-2); overflow: hidden;
}
.emaji-page .e-pbar-fill {
  height: 100%; border-radius: 99px;
  background: var(--brand);
  transition: width .6s cubic-bezier(.2,.8,.2,1);
}

/* ── Avatar ─────────────────────────────────────────────────────── */
.emaji-page .e-avatar {
  border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; color: #fff;
  background: linear-gradient(150deg, var(--brand), color-mix(in srgb, var(--brand) 55%, #111));
}

/* ── Horizontal scroll strip ────────────────────────────────────── */
.emaji-page .e-hscroll {
  display: flex; gap: 12px;
  overflow-x: auto; scrollbar-width: none;
  margin: 0 -18px; padding: 2px 18px 6px;
}
.emaji-page .e-hscroll::-webkit-scrollbar { display: none; }

/* ── Text utilities ─────────────────────────────────────────────── */
.emaji-page .e-muted  { color: var(--ink-2); }
.emaji-page .e-muted3 { color: var(--ink-3); }
.emaji-page .e-divider { height: 1px; background: var(--line); margin: 4px 0; }
