/* ============================================================
   Erion — Theme
   Palette: pink #EC008C → purple #7A3AB8 → blue #17A6DE
   Admin sidebar: #0F1B2D
   ============================================================ */

:root {
  --brand-pink: #EC008C;
  --brand-purple: #7A3AB8;
  --brand-blue: #17A6DE;
  --brand-gradient: linear-gradient(180deg, #EC008C 0%, #7A3AB8 55%, #17A6DE 100%);
  --brand-gradient-h: linear-gradient(90deg, #EC008C 0%, #7A3AB8 55%, #17A6DE 100%);
  --admin-navy: #0F1B2D;
  --admin-navy-2: #16243B;
  --admin-navy-hover: #1E3252;
  --ink: #1F2937;
  --ink-soft: #6B7280;
  --line: #E5E7EB;
  --bg: #F5F6FA;
  --card: #FFFFFF;
  --success: #16A34A;
  --danger: #DC2626;
  --warning: #F59E0B;
  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-purple); text-decoration: none; }
a:hover { color: var(--brand-pink); }

/* ---------- Utilities ---------- */
.brand-gradient { background: var(--brand-gradient); }
.brand-gradient-h { background: var(--brand-gradient-h); }
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.grow { flex: 1; }
.text-center { text-align: center; }
.text-muted { color: var(--ink-soft); }
.hide { display: none !important; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 999px; border: 0;
  font-weight: 600; font-size: 14px; cursor: pointer;
  transition: transform .06s ease, box-shadow .12s ease, opacity .12s ease;
  text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand-gradient-h); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { color: #fff; box-shadow: var(--shadow); }
.btn-pink { background: var(--brand-pink); color: #fff; }
.btn-outline { background: transparent; border: 1.5px solid var(--brand-pink); color: var(--brand-pink); }
.btn-dark { background: #111827; color: #fff; }
.btn-green { background: #16A34A; color: #fff; }
.btn-green:hover { color: #fff; background: #15803D; }
.btn-block { display: flex; width: 100%; }

/* ---------- Cards ---------- */
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 20px;
}
.card-title { font-size: 15px; font-weight: 700; margin: 0 0 12px; color: var(--ink); }

/* ---------- Public layout ---------- */
.pub-topbar {
  background: #fff; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 40;
}
.pub-topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px; max-width: 1200px; margin: 0 auto;
}
.pub-logo img { height: 42px; display: block; }
.pub-nav { display: flex; gap: 22px; align-items: center; }
.pub-nav a { color: var(--ink); font-weight: 500; }
.pub-nav a:hover { color: var(--brand-pink); }

.pub-hero {
  background: var(--brand-gradient-h);
  color: #fff;
  padding: 72px 24px;
}
.pub-hero-inner {
  max-width: 1200px; margin: 0 auto;
  display: grid; grid-template-columns: 1.2fr 1fr; gap: 40px; align-items: center;
}
.pub-hero h1 { font-size: 44px; font-weight: 800; margin: 0 0 16px; line-height: 1.15; }
.pub-hero p  { font-size: 18px; margin: 0 0 24px; opacity: .95; }
.pub-hero .btn-primary { background: #fff; color: var(--brand-pink); }
.pub-hero .btn-outline { color: #fff; border-color: #fff; }

.pub-section { padding: 56px 24px; }
.pub-section h2 { font-size: 30px; margin: 0 0 24px; text-align: center; }

.pub-footer {
  background: #0F1B2D; color: #cbd5e1;
  padding: 32px 24px; text-align: center; font-size: 14px;
}
.pub-footer a { color: #fff; }

/* ---------- Member layout ---------- */
.app-shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }

.member-sidebar {
  background: var(--brand-gradient);
  color: #fff;
  padding: 20px 0; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.member-sidebar-logo {
  background: #fff; border-radius: 14px; padding: 12px;
  width: 76%; margin: 0 auto 24px; display: flex; justify-content: center;
}
.member-sidebar-logo img { max-width: 100%; height: 60px; object-fit: contain; }
.member-nav { list-style: none; margin: 0; padding: 0 12px; }
.member-nav li { margin: 4px 0; }
.member-nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 10px;
  color: rgba(255,255,255,.9); font-weight: 500; font-size: 14.5px;
  transition: background .12s ease, color .12s ease;
}
.member-nav a:hover { background: rgba(255,255,255,.14); color: #fff; }
.member-nav a.active {
  background: #fff; color: var(--brand-pink); box-shadow: var(--shadow-sm);
}
.member-nav .icon { width: 18px; height: 18px; flex-shrink: 0; }
.member-nav .nav-group {
  display: block; padding: 11px 14px 4px; font-size: 12px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase; color: rgba(255,255,255,.6);
}

.member-topbar {
  background: #fff; border-bottom: 1px solid var(--line);
  padding: 12px 24px; display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.member-topbar .greeting { color: var(--ink); font-weight: 600; }
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }

/* Off-canvas nav trigger — only shown at the <=900px breakpoint. */
.nav-toggle {
  display: none; align-items: center; justify-content: center;
  width: 40px; height: 40px; flex-shrink: 0; padding: 0; cursor: pointer;
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
}
.nav-toggle span { display: block; width: 18px; height: 2px; background: var(--ink); position: relative; }
.nav-toggle span::before,
.nav-toggle span::after {
  content: ''; position: absolute; left: 0; width: 18px; height: 2px; background: var(--ink);
}
.nav-toggle span::before { top: -6px; }
.nav-toggle span::after  { top: 6px; }
.sidebar-backdrop { display: none; }

/* Inline result line under a member-ID input (see data-lookup in app.js). */
.lookup-result { font-size: 12.5px; margin-top: 5px; min-height: 17px; font-weight: 600; }
.lookup-result.is-muted { color: var(--ink-soft); font-weight: 400; }
.lookup-result.is-good  { color: var(--success); }
.lookup-result.is-warn  { color: #B45309; }
.lookup-result.is-bad   { color: var(--danger); }

.member-content { padding: 24px; }

/* Wallet tiles like image6.jpeg */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.tile {
  border-radius: var(--radius); padding: 18px; color: #fff;
  box-shadow: var(--shadow-sm);
}
.tile-pink   { background: linear-gradient(135deg, #EC008C, #FF4DA8); }
.tile-green  { background: linear-gradient(135deg, #16A34A, #4ADE80); }
.tile-blue   { background: linear-gradient(135deg, #2563EB, #60A5FA); }
.tile-purple { background: linear-gradient(135deg, #7A3AB8, #A855F7); }
.tile-teal   { background: linear-gradient(135deg, #0D9488, #14B8A6); }
.tile-orange { background: linear-gradient(135deg, #F97316, #FB923C); }
.tile-dark   { background: linear-gradient(135deg, #111827, #1F2937); }
.tile .label { font-size: 13px; opacity: .9; margin-bottom: 6px; }
.tile .value { font-size: 22px; font-weight: 700; }
.tile { display: flex; align-items: flex-start; gap: 14px; }
.tile .tile-icon {
  width: 40px; height: 40px; flex-shrink: 0; border-radius: 10px;
  background: rgba(255, 255, 255, .22);
  display: flex; align-items: center; justify-content: center; font-size: 19px; line-height: 1;
}
.tile .tile-body { min-width: 0; }

/* Referral link block on the member dashboard */
.referral-box {
  margin-top: 16px; padding: 12px 14px; background: #F5F6FA;
  border-radius: 8px; font-size: 13px; color: var(--ink-soft);
}
.referral-box .referral-url {
  display: block; background: #fff; border: 1px solid var(--line); border-radius: 6px;
  padding: 8px 10px; margin: 8px 0 10px; font-family: monospace; font-size: 12.5px;
  color: var(--ink); word-break: break-all;
}
.referral-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Credit line at the bottom of the member and admin panels */
.panel-footer {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 14px 24px; border-top: 1px solid var(--line); background: #fff;
  font-size: 12px; color: var(--ink-soft);
}
.panel-footer a { color: var(--brand-pink); font-weight: 600; }

/* Genealogy tree */
.tree-root, .tree-children { list-style: none; margin: 0; padding: 0; }
.tree-children { margin-left: 12px; padding-left: 14px; border-left: 2px solid var(--line); }
.tree-node { margin: 3px 0; }
.tree-row {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  padding: 7px 10px; border-radius: 7px; background: #F9FAFB; font-size: 13px;
}
.tree-row:hover { background: #F1F3F7; }
.tree-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.tree-dot.is-active   { background: var(--success); }
.tree-dot.is-inactive { background: #F59E0B; }
.tree-name { font-weight: 600; }
.tree-code { font-size: 11.5px; color: var(--ink-soft); }

/* Welcome letter + ID card */
.print-actions { display: flex; gap: 8px; justify-content: flex-end; margin-bottom: 14px; flex-wrap: wrap; }
.id-card {
  width: 380px; max-width: 100%; border-radius: 14px; overflow: hidden;
  background: #fff; box-shadow: var(--shadow); border: 1px solid var(--line);
}
.id-card-head {
  display: flex; align-items: center; gap: 12px; padding: 16px;
  background: var(--brand-gradient-h); color: #fff;
}
.id-card-head img { height: 38px; background: #fff; border-radius: 8px; padding: 4px; }
.id-card-brand { font-weight: 700; font-size: 16px; }
.id-card-sub { font-size: 11.5px; opacity: .9; }
.id-card-body { display: flex; align-items: center; gap: 14px; padding: 18px 16px 12px; }
.id-card-avatar {
  width: 62px; height: 62px; border-radius: 12px; flex-shrink: 0;
  background: var(--brand-gradient); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 700;
}
.id-card-name { font-weight: 700; font-size: 16px; }
.id-card-code { font-family: monospace; font-size: 13px; color: var(--ink-soft); margin: 2px 0 6px; }
.id-card-rows { width: 100%; font-size: 12.5px; padding: 0 16px; border-collapse: collapse; }
.id-card-rows td { padding: 6px 0; border-top: 1px solid var(--line); }
.id-card-rows td:first-child { color: var(--ink-soft); width: 90px; }
.id-card-rows td:last-child { text-align: right; font-weight: 600; }
.id-card-foot {
  display: flex; justify-content: space-between; gap: 8px;
  padding: 12px 16px; margin-top: 10px; background: #F5F6FA;
  font-size: 10.5px; color: var(--ink-soft);
}

/* ---------- Public front page ---------- */
.pub-lead { color: var(--ink-soft); font-size: 15px; margin: -6px 0 26px; max-width: 620px; }
.pub-section-alt { background: #F5F6FA; }

.pub-strip { background: var(--admin-navy); color: #fff; padding: 26px 0; }
.pub-strip-inner {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 18px; text-align: center;
}
.pub-strip-inner div { display: flex; flex-direction: column; gap: 3px; font-size: 13px; opacity: .85; }
.pub-strip-num { font-size: 27px; font-weight: 700; opacity: 1; }

.pub-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.pub-card {
  background: #fff; border-radius: var(--radius); padding: 22px;
  box-shadow: var(--shadow-sm); border: 1px solid var(--line);
}
.pub-card-icon {
  width: 46px; height: 46px; border-radius: 12px; margin-bottom: 12px;
  background: var(--brand-gradient); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 22px;
}
.pub-price { text-align: center; }
.pub-price-amt {
  font-size: 34px; font-weight: 700; margin: 8px 0 16px;
  background: var(--brand-gradient-h); -webkit-background-clip: text;
  background-clip: text; -webkit-text-fill-color: transparent;
}

.pub-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 16px; }
.pub-step { background: #fff; border-radius: var(--radius); padding: 22px; border: 1px solid var(--line); }
.pub-step h3 { font-size: 15.5px; margin: 12px 0 6px; }
.pub-step p { font-size: 13.5px; margin: 0; }
.pub-step-n {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--brand-gradient-h); color: #fff; font-weight: 700; font-size: 15px;
}

.pub-rewards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.pub-reward {
  background: #fff; border-radius: var(--radius); padding: 18px;
  border: 1px solid var(--line); text-align: center;
}
.pub-reward-gift { font-weight: 700; font-size: 15px; }
.pub-reward-cond { font-size: 12.5px; color: var(--ink-soft); margin-top: 4px; }
.pub-reward-cash { font-size: 12px; color: var(--brand-pink); font-weight: 600; margin-top: 6px; }

.pub-cta { background: var(--brand-gradient-h); color: #fff; padding: 56px 0; text-align: center; }
.pub-cta h2 { color: #fff; margin-bottom: 8px; }
.pub-cta p { opacity: .92; margin-bottom: 22px; }
.pub-cta .btn-outline { border-color: #fff; color: #fff; }
.pub-cta .btn-primary { background: #fff; color: var(--brand-pink); }

/* Support ticket thread */
.ticket-thread { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.ticket-msg { border-radius: 10px; padding: 11px 14px; max-width: 82%; }
.ticket-msg.from-member { background: #F1F3F7; align-self: flex-start; }
.ticket-msg.from-admin  { background: #FCE7F3; align-self: flex-end; }
.ticket-msg-head {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 11.5px; color: var(--ink-soft); margin-bottom: 5px;
}
.ticket-msg-body { font-size: 13.5px; line-height: 1.6; word-break: break-word; }

/* Awards & Rewards */
.reward-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.reward-tab {
  padding: 9px 16px; border-radius: 999px; font-size: 13.5px; font-weight: 600;
  background: #fff; border: 1px solid var(--line); color: var(--ink-soft);
}
.reward-tab:hover { color: var(--brand-pink); }
.reward-tab.is-active { background: var(--brand-gradient-h); color: #fff; border-color: transparent; }
.reward-row { padding: 14px 0; border-bottom: 1px solid var(--line); }
.reward-row:last-child { border-bottom: none; }
.reward-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: center; }
.reward-title { font-weight: 700; font-size: 14.5px; }
.reward-bar { height: 8px; border-radius: 999px; background: #E9EBF0; margin: 9px 0 6px; overflow: hidden; }
.reward-bar-fill { height: 100%; border-radius: 999px; background: var(--brand-gradient-h); }
.reward-row.is-done .reward-bar-fill { background: linear-gradient(90deg, #16A34A, #4ADE80); }
.reward-foot {
  display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  font-size: 12px; color: var(--ink-soft);
}

@media print {
  .member-sidebar, .admin-sidebar, .member-topbar, .admin-topbar,
  .panel-footer, .print-actions, .sidebar-backdrop { display: none !important; }
  .app-shell { display: block; }
  .member-content, .admin-content { padding: 0; }
  .printable { box-shadow: none; border: none; }
  body { background: #fff; }
}

/* ---------- Admin layout ---------- */
.admin-sidebar {
  background: var(--admin-navy);
  color: #E5E7EB;
  padding: 20px 0; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.admin-sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 20px 22px; color: #fff; font-weight: 700; font-size: 18px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.admin-sidebar-brand .shield { color: var(--brand-pink); }
.admin-nav { list-style: none; margin: 12px 0; padding: 0 12px; }
.admin-nav li { margin: 2px 0; }
.admin-nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: 8px;
  color: #CBD5E1; font-weight: 500; font-size: 14px;
  transition: background .12s ease, color .12s ease;
}
.admin-nav a:hover { background: var(--admin-navy-hover); color: #fff; }
.admin-nav a.active {
  background: var(--brand-pink); color: #fff;
}
.admin-nav .divider { height: 1px; background: rgba(255,255,255,.06); margin: 12px 8px; }
.admin-nav .logout { color: #F87171; }
.admin-nav .logout:hover { background: rgba(248,113,113,.1); color: #FCA5A5; }

.admin-topbar {
  background: #fff; border-bottom: 1px solid var(--line);
  padding: 14px 28px; display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.admin-topbar h1 { font-size: 17px; margin: 0; font-weight: 700; }
.admin-topbar .who { text-align: right; font-size: 13px; }
.admin-topbar .who .name { font-weight: 600; }
.admin-topbar .who .status { color: var(--success); font-size: 12px; }

.admin-content { padding: 24px 28px; background: var(--bg); min-height: calc(100vh - 56px); }

.section-title {
  font-size: 14px; font-weight: 700; color: var(--ink);
  border-left: 3px solid var(--brand-pink);
  padding-left: 10px; margin: 20px 0 12px;
}

/* Admin stat cards like image9.jpeg */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.stat-card {
  background: #fff; border-radius: var(--radius); padding: 16px 18px;
  display: flex; align-items: center; gap: 14px; box-shadow: var(--shadow-sm);
}
.stat-card .icon-wrap {
  width: 46px; height: 46px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.stat-card .stat-value { font-size: 22px; font-weight: 800; margin: 0; }
.stat-card .stat-label { font-size: 12px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .04em; }
.stat-card .stat-sub { font-size: 11px; color: var(--ink-soft); margin-top: 2px; }

/* soft icon backgrounds */
.ic-purple { background: #F3E8FF; color: #7A3AB8; }
.ic-pink   { background: #FCE7F3; color: #EC008C; }
.ic-blue   { background: #DBEAFE; color: #2563EB; }
.ic-green  { background: #DCFCE7; color: #16A34A; }
.ic-red    { background: #FEE2E2; color: #DC2626; }
.ic-orange { background: #FEF3C7; color: #F59E0B; }
.ic-teal   { background: #CCFBF1; color: #0D9488; }

/* Tables */
.table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.table th, .table td { padding: 12px 14px; text-align: left; font-size: 13.5px; }
.table thead { background: #FAFAFB; }
.table th { color: var(--ink-soft); text-transform: uppercase; font-size: 11.5px; letter-spacing: .04em; }
.table tbody tr { border-top: 1px solid var(--line); }
.table tbody tr:hover { background: #FAFAFB; }

.badge { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.badge-green { background: #DCFCE7; color: #15803D; }
.badge-red   { background: #FEE2E2; color: #B91C1C; }
.badge-amber { background: #FEF3C7; color: #B45309; }
.badge-blue  { background: #DBEAFE; color: #1D4ED8; }

/* Forms */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--ink); }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 10px 12px; font-size: 14px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: 0; border-color: var(--brand-pink);
  box-shadow: 0 0 0 3px rgba(236, 0, 140, 0.14);
}
.form-hint { font-size: 12px; color: var(--ink-soft); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; }

.alert { padding: 12px 14px; border-radius: 10px; font-size: 14px; margin-bottom: 14px; }
.alert-error   { background: #FEE2E2; color: #B91C1C; border: 1px solid #FCA5A5; }
.alert-success { background: #DCFCE7; color: #15803D; border: 1px solid #86EFAC; }
.alert-warn    { background: #FEF3C7; color: #B45309; border: 1px solid #FCD34D; }

/* Auth pages */
.auth-shell {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--brand-gradient); padding: 24px;
}
.auth-card {
  background: #fff; border-radius: 16px; padding: 32px;
  width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.auth-card .logo { text-align: center; margin-bottom: 20px; }
.auth-card .logo img { height: 70px; }
.auth-card h1 { text-align: center; font-size: 22px; margin: 0 0 8px; }
.auth-card .sub { text-align: center; color: var(--ink-soft); font-size: 14px; margin-bottom: 22px; }

/* Responsive */
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .member-sidebar, .admin-sidebar { position: fixed; left: -260px; transition: left .2s ease; z-index: 50; width: 260px; }
  .app-shell.sidebar-open .member-sidebar,
  .app-shell.sidebar-open .admin-sidebar { left: 0; }
  .nav-toggle { display: inline-flex; }
  .sidebar-backdrop { position: fixed; inset: 0; background: rgba(15,27,45,.5); z-index: 40; }
  .app-shell.sidebar-open .sidebar-backdrop { display: block; }
  .member-topbar, .admin-topbar { padding-left: 16px; padding-right: 16px; }
  .member-content, .admin-content { padding: 16px; }
  .pub-hero-inner { grid-template-columns: 1fr; text-align: center; }
  .pub-hero h1 { font-size: 32px; }
}
