* { box-sizing: border-box; margin: 0; }
[hidden] { display: none !important; }
body {
  font-family: system-ui, -apple-system, sans-serif;
  background: #f5f4fa;
  color: #1a202c;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
header {
  position: sticky; top: 0; z-index: 100;
  background: linear-gradient(180deg, #5a4bb5 0%, #4a3b8c 100%);
  color: #fff; padding: 1rem 1.5rem;
  display: flex; justify-content: space-between; align-items: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
header h1 { font-size: 1.4rem; display: flex; align-items: center; gap: .5rem; }
.logo-tile {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%;
  background: #fff; border: 2px solid #4a3b8c; font-size: 17px;
}
.header-left { display: flex; align-items: center; gap: .6rem; }
#user-badge { display: flex; gap: .8rem; align-items: center; font-size: .9rem; }
.header-right { display: flex; gap: 1rem; align-items: center; }
#guest-nav { display: flex; gap: .6rem; align-items: center; }
#guest-nav .small {
  background: none; border: none; color: #d9d2f5; font-size: .95rem;
  text-decoration: underline; text-underline-offset: 3px; padding: .3rem .4rem;
  border-radius: 4px; cursor: pointer;
}
#guest-nav .small:hover { color: #fff; background: rgba(255,255,255,.15); text-decoration: none; }

main { flex: 1; width: 100%; max-width: 860px; margin: 0 auto; padding: 1.2rem 1rem 3rem; }

.hero { text-align: center; padding: 3rem 1rem; }
.hero h2 { font-size: 2.2rem; line-height: 1.2; color: #32276e; }
.hero .accent { color: #6b54d8; }
.tagline { margin: 1rem auto 1.5rem; max-width: 520px; color: #4a5568; }
.cta-row { display: flex; gap: .8rem; justify-content: center; align-items: center; flex-wrap: wrap; margin: 1rem 0; }
.how-card { text-align: left; max-width: 560px; margin: 2rem auto 0; }
.how-card ol { padding-left: 1.4rem; display: grid; gap: .5rem; color: #3d4663; }

button {
  background: #4a3b8c; color: #fff; border: none; border-radius: 8px;
  padding: .6rem 1.1rem; font-size: .95rem; cursor: pointer;
}
button:not([class]):hover, button.small:hover { background: #3d2f75; }
button.ghost-btn { background: transparent; border: 1px solid #4a3b8c; color: #4a3b8c; }
button.ghost-btn:hover { background: #ece8f8; }
button.danger { background: #b8324f; }
button.danger:hover { background: #99263e; }
button.small { padding: .35rem .7rem; font-size: .82rem; border-radius: 6px; }
button:disabled { opacity: .5; cursor: not-allowed; }

#tabs { display: flex; gap: .4rem; margin-bottom: 1rem; border-bottom: 2px solid #e3e0f2; }
.tab {
  background: none; color: #6b6590; border: none; border-bottom: 3px solid transparent;
  border-radius: 0; padding: .7rem 1.1rem; font-size: 1rem;
}
.tab.on { color: #4a3b8c; border-bottom-color: #4a3b8c; font-weight: 600; }
.tab:hover, .tab:active, .tab:focus { background: none; color: #4a3b8c; border-bottom-color: #b6aee0; outline: none; }
.tab-radio { accent-color: #4a3b8c; margin-right: .45rem; vertical-align: middle; pointer-events: none; }

.card {
  background: #fff; border: 1px solid #e3e0f2; border-radius: 12px;
  padding: 1.2rem; margin-bottom: 1.1rem;
  box-shadow: 0 1px 4px rgba(74,59,140,.06);
}
.card h3 { margin-bottom: .8rem; color: #32276e; font-size: 1.05rem; }
.card h3 .small { float: right; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } }
input, select, textarea {
  width: 100%; padding: .6rem .7rem; border: 1px solid #cfc8e8; border-radius: 8px;
  font-size: .95rem; background: #fff; color: #1a202c;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #b8a9ee; border-color: #8d78d6; }
textarea { margin-top: .6rem; min-height: 70px; resize: vertical; }
.row { display: flex; gap: .8rem; align-items: center; }

.muted { color: #8a87a3; font-size: .88rem; }
.small { font-size: .82rem; }

.list-item {
  border: 1px solid #ece9f7; border-radius: 10px; padding: .8rem;
  margin-top: .7rem; display: flex; justify-content: space-between;
  align-items: center; gap: .8rem; flex-wrap: wrap;
}
.list-item .meta { font-size: .85rem; color: #6b6590; }
.badge {
  display: inline-block; padding: .15rem .6rem; border-radius: 999px;
  font-size: .78rem; font-weight: 600;
}
.badge.PENDING { background: #fef3c7; color: #92400e; }
.badge.APPROVED, .badge.READY { background: #d1fae5; color: #065f46; }
.badge.REJECTED, .badge.UPLOADING { background: #fee2e2; color: #991b1b; }
.badge.REVIEWED { background: #e0e7ff; color: #3730a3; }
.badge.UNSEALED { background: #fef3c7; color: #92400e; }

/* collapsible claim items */
.clm-item { border: 1px solid #ece9f7; border-radius: 10px; margin-top: .7rem; overflow: hidden; }
.clm-head {
  width: 100%; display: flex; justify-content: space-between; align-items: center;
  gap: .6rem; background: none; color: #2d2653; border: none; border-radius: 0;
  padding: .8rem; font-size: .95rem; text-align: left;
}
.clm-head:hover, .clm-head:active, .clm-head:focus {
  background: #f7f5fd; color: #4a3b8c; outline: none;
}
.clm-chev { color: #6b6590; font-size: .85rem; flex-shrink: 0; }
.clm-body { padding: 0 .8rem .8rem; border-top: 1px solid #ece9f7; }
.clm-head .meta { font-size: .82rem; color: #6b6590; font-weight: 400; }
.clm-body .meta { font-size: .85rem; color: #6b6590; padding-top: .6rem; }
.clm-ev { margin-top: .5rem; font-size: .85rem; }
.clm-vids video { width: 100%; margin-top: .3rem; }

video { max-width: 100%; border-radius: 10px; background: #000; margin-top: .5rem; }
#rec-preview { width: 100%; max-height: 320px; }

.modal {
  position: fixed; inset: 0; z-index: 200; background: rgba(20,16,45,.5);
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.modal-card { position: relative; max-width: 420px; width: 100%; }
.modal-x {
  position: absolute; top: .6rem; right: .7rem; background: none; border: none;
  font-size: 1.1rem; color: #8a87a3; cursor: pointer; padding: .2rem .4rem;
}
.modal-x:hover { color: #1a202c; background: none; }

.claim-card { cursor: pointer; }
.claim-card:hover { border-color: #b8a9ee; }
.tag-chip {
  display: inline-block; background: #ece8f8; color: #4a3b8c;
  border-radius: 999px; padding: .15rem .6rem; font-size: .78rem; margin: .15rem .2rem 0 0;
}
a { color: #4a3b8c; }

.demo-users { max-width: 560px; margin: 1.5rem auto 0; text-align: left; }
.demo-users summary { cursor: pointer; font-weight: 600; color: #32276e; }
.demo-table { width: 100%; border-collapse: collapse; margin-top: .8rem; }
.demo-table td { padding: .4rem .3rem; border-top: 1px solid #ece9f7; font-size: .9rem; }

.public-stats { color: #6b6590; font-size: .9rem; margin: .4rem 0 .8rem; }
.public-stats b { color: #4a3b8c; }
.sealed-banner { background: #fdf2e3; border-color: #e8b45a; }
.sealed .cta-row, .sealed #ben-add-btn, .sealed #selfie-btn { display: none; }

.modal[hidden] { display: none; }

.back-qb {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; margin-left: 1rem; border-radius: 999px;
  color: #d9d2f5; border: 1px solid rgba(255,255,255,.35);
  font-size: .72rem; text-decoration: none; white-space: nowrap;
  vertical-align: middle;
}
.back-qb:hover { color: #fff; border-color: #fff; text-decoration: none; }

.flow-wrap { margin: 0 auto .6rem; max-width: 560px; }
.flow { width: 100%; height: auto; }
.flow .lbl { font-size: 12px; fill: #4a5568; font-weight: 600; }
.flow-word { font-size: 12px; fill: #6b54d8; font-weight: 700; }

.copyright-bar { text-align: center; padding: 1rem 1rem 1.6rem; border-top: 1px solid #e2e0f0; }
.copyright-bar a { color: #6b54d8; text-decoration: none; }
.copyright-bar a:hover { text-decoration: underline; }

/* Mobile header wrap — same strategy as TenaLink: right side drops to a
   second line instead of squeezing buttons until their text wraps */
@media (max-width: 560px) {
  header { flex-wrap: wrap; padding: .75rem 1rem; row-gap: .4rem; }
  header h1 { font-size: 1.15rem; }
  .header-right { flex-wrap: wrap; justify-content: flex-end; row-gap: .3rem; }
  #guest-nav { gap: .7rem; }
  #guest-nav .small, #lang-toggle { font-size: .85rem; padding: .2rem .3rem; }
  #user-badge { flex-wrap: wrap; gap: .4rem; font-size: .8rem; }
  header button { white-space: nowrap; }
  #tabs { flex-wrap: wrap; }
}

/* Mobile: vertical stepper replaces the wide SVG diagram */
.flow-steps { display: none; }
@media (max-width: 560px) {
  .how-card .flow-wrap { display: none; }
  .flow-steps {
    display: flex; flex-direction: column; gap: .5rem;
    list-style: none; padding: 0; margin: 0 0 .8rem;
  }
  .flow-steps li {
    display: flex; gap: .65rem; align-items: center;
    background: #f6f4fc; border: 1.5px solid #e3e0f2; border-radius: 10px;
    padding: .55rem .7rem; animation: fsGlow 20s infinite;
  }
  .flow-steps li:nth-child(2) { animation-delay: 4s; }
  .flow-steps li:nth-child(3) { animation-delay: 8s; }
  .flow-steps li:nth-child(4) { animation-delay: 12s; }
  .flow-steps li:nth-child(5) { animation-delay: 16s; }
  .fs-n {
    width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
    background: #ece8f8; color: #4a3b8c; font-weight: 700; font-size: .85rem;
    display: flex; align-items: center; justify-content: center;
  }
  .flow-steps b { color: #4a3b8c; }
  .flow-steps small { color: #4a5568; line-height: 1.35; }
}
@keyframes fsGlow {
  0%, 20% { background: #ece8f8; border-color: #6b54d8; box-shadow: 0 0 0 2px rgba(107,84,216,.22); }
  25%, 100% { background: #f6f4fc; border-color: #e3e0f2; box-shadow: none; }
}

.anim-row { display: none; margin: .2rem 0 .6rem; }
@media (max-width: 560px) {
  .anim-row { display: block; }
  .hero h2 { font-size: 1.65rem; }
  .hero { padding: 1.6rem .8rem; }
  .tagline { font-size: .95rem; margin: .8rem auto 1.1rem; }
}

.anim-link { font-size: .8rem; font-weight: 500; color: #6b54d8; text-decoration: underline; text-underline-offset: 3px; }
.anim-link:hover { color: #4a3b8c; }
.anim-link { font-size: .8rem; font-weight: 500; color: #6b54d8; text-decoration: underline; text-underline-offset: 3px; }
.anim-link:hover { color: #4a3b8c; }

/* Landing stats — label on its own line, colored count-up numbers */
.public-stats { margin: .4rem 0 .9rem; }
.live-label { font-size: .82rem; color: #6b6590; letter-spacing: .02em; }
.stats-row { display: flex; gap: 1.6rem; justify-content: center; flex-wrap: wrap; margin-top: .3rem; }
.stat { text-align: center; }
.stat-n { display: block; font-size: 1.4rem; font-weight: 800; }
.stat-n.c-own { color: #2b6cb0; }
.stat-n.c-ben { color: #12805f; }
.stat-n.c-vid { color: #6b54d8; }
.stat-n.c-clm { color: #b7791f; }
.stat-n.c-rel { color: #16a34a; }
.stat-l { font-size: .74rem; color: #6b6590; }
@media (max-width: 560px) { .stats-row { gap: 1rem; } .stat-n { font-size: 1.2rem; } }

/* Add-beneficiary dropdown (TenaLink menu pattern) */
.menu-wrap { position: relative; display: inline-block; }
.drop-menu {
  position: absolute; top: calc(100% + 4px); right: 0; z-index: 60;
  min-width: 200px; padding: .4rem; display: flex; flex-direction: column;
}
.drop-menu[hidden] { display: none; }
.drop-menu a { padding: .55rem .8rem; color: #1a202c; text-decoration: none; border-radius: 6px; font-size: .95rem; }
.drop-menu a:hover { background: #ece8f8; color: #4a3b8c; }

/* Collapsible beneficiaries */
.ben-item { border: 1px solid #e3e0f2; border-radius: 10px; margin: .4rem 0; background: #fff; }
.ben-item summary {
  cursor: pointer; padding: .6rem .8rem; list-style: none;
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
}
.ben-item summary::-webkit-details-marker { display: none; }
.ben-item summary::before { content: "▸"; color: #6b54d8; font-size: .8rem; }
.ben-item[open] summary::before { content: "▾"; }
.ben-item summary b { color: #32276e; }
.ben-body { padding: 0 .8rem .7rem 1.9rem; }
.ben-body .cta-row { justify-content: flex-start; flex-wrap: wrap; gap: .4rem; }

.type-row { display: flex; gap: .5rem; margin: .6rem 0 .8rem; }
.type-chip {
  display: flex; align-items: center; gap: .35rem; cursor: pointer;
  border: 1.5px solid #e3e0f2; border-radius: 999px; padding: .35rem .9rem;
  font-size: .9rem; color: #4a5568; background: #f6f4fc;
}
.type-chip input { accent-color: #6b54d8; width: auto; }
.type-chip:has(input:checked) { border-color: #6b54d8; background: #ece8f8; color: #32276e; font-weight: 600; }

.rec-target { font-weight: 600; color: #4a3b8c; margin: .3rem 0; }

/* Focus highlight on the open beneficiary */
.ben-item[open] { border-color: #6b54d8; box-shadow: 0 0 0 2px rgba(107,84,216,.18); }
.ben-item[open] summary { background: #ece8f8; border-radius: 9px 9px 0 0; }

/* Expanded beneficiary sections */
.ben-sec { padding: .45rem 0; border-bottom: 1px dashed #e3e0f2; }
.ben-sec-h { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #6b54d8; margin-bottom: .25rem; }
.ben-sec button { margin-top: .35rem; }
.ben-vid-actions { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; margin: .3rem 0 0 1.1rem; }
.ben-danger { padding-top: .5rem; }

/* Identity strip + info modal */
.id-strip { display: flex; align-items: center; gap: .9rem; padding: .8rem 1rem; }
.avatar { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; border: 2px solid #e3e0f2; cursor: pointer; flex-shrink: 0; }
.avatar-empty {
  display: flex; align-items: center; justify-content: center;
  border: 2px dashed #b9b2e0; color: #6b54d8; font-size: 1.5rem; font-weight: 300;
  background: #f6f4fc;
}
.avatar-empty[hidden] { display: none !important; }
.avatar-empty:hover { border-color: #6b54d8; background: #ece8f8; }
.avatar-lg { width: 110px; height: 110px; font-size: 2.4rem; }
.id-meta { display: flex; flex-direction: column; gap: .15rem; }
.id-meta b { color: #32276e; }
.id-edit { font-size: .85rem; color: #6b54d8; text-decoration: none; }
.id-edit:hover { text-decoration: underline; }
.id-modal-body { display: flex; flex-direction: column; align-items: center; gap: .8rem; margin: .6rem 0 .4rem; }

/* Header profile menu (TenaLink pattern) */
#profile-btn { color: #fff; }
.pm-head { display: flex; gap: .6rem; align-items: center; padding: .35rem .5rem .5rem; border-bottom: 1px solid #e3e0f2; margin-bottom: .3rem; }
.pm-head .avatar { width: 40px; height: 40px; font-size: 1.1rem; }
.pm-meta b { color: #32276e; font-size: .9rem; }
.pm-meta .meta { font-size: .75rem; }

.avatar-sm { width: 26px; height: 26px; font-size: .8rem; vertical-align: middle; margin-right: .35rem; }
.avatar-empty.avatar-sm { display: inline-flex; }
#profile-btn { display: inline-flex; align-items: center; }

/* bilingual date-picker popup (ethcal.js) */
.calpop {
  position: fixed; z-index: 300; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 300px; max-width: calc(100vw - 24px); padding: 12px;
  background: #fff; border: 1px solid #e3e0f2; border-radius: 14px;
  box-shadow: 0 16px 48px rgba(40,30,90,.30); font-size: 13px; color: #32276e;
}
@media (max-width: 640px) {
  .calpop { padding: 14px; }
  .calpop .cp-day { padding: 10px 0; font-size: 15px; }
  .calpop .cp-wd { font-size: 11px; padding: 4px 0; }
  .calpop select.cp-month, .calpop select.cp-year { font-size: 14px; padding: 5px 4px; }
  .calpop .cp-toggle label { font-size: 14px; padding: 7px 8px; }
}
.cp-toggle { display: flex; gap: 10px; margin-bottom: 8px; }
.cp-toggle label {
  display: flex; align-items: center; gap: 4px; padding: 4px 8px;
  border: 1px solid #e3e0f2; border-radius: 8px; background: #fff;
  color: #4a3b8c; font-size: 12px; cursor: pointer; flex: 1; justify-content: center;
}
.cp-toggle label.on { border-color: #6b54d8; color: #4a3b8c; font-weight: 600; }
.cp-toggle input { accent-color: #6b54d8; margin: 0; }
.cp-nav { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
select.cp-month { flex: 1; min-width: 0; }
select.cp-year { width: 62px; flex-shrink: 0; }
select.cp-month, select.cp-year {
  border: 1px solid #d4cef0; border-radius: 6px; font-size: 12px;
  padding: 3px 2px; color: #32276e; background: #fff; font-weight: 600;
}
.cp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; text-align: center; }
.cp-wd { font-size: 10px; color: #9a93c0; padding: 2px 0; }
.cp-day {
  padding: 4px 0; border: 0; background: none; border-radius: 6px;
  font-size: 12px; cursor: pointer; color: #32276e;
}
.cp-day:hover { background: #ece8f8; }
.cp-day.today { outline: 1px solid #6b54d8; }
.cp-day.sel { background: #6b54d8; color: #fff; }
.dob-row { display: flex; gap: .4rem; align-items: center; }
.dob-row input { flex: 1; }
.cal-btn { background: #ece8f8; border: 1px solid #d4cef0; border-radius: 8px; padding: .5rem .7rem; font-size: 1rem; }
.cal-btn:hover { background: #ddd6f3; }

.pm-rows { display: flex; flex-direction: column; gap: .3rem; min-width: 230px; }
.pm-row { display: flex; justify-content: space-between; gap: 1rem; font-size: .82rem; }
.pm-row span { color: #6b6590; }
.pm-row b { color: #32276e; font-weight: 600; }

.id-msg { font-size: .85rem; margin-top: .6rem; min-height: 1em; }
.id-msg.error { color: #b3261e; font-weight: 600; }
.id-msg.ok { color: #1b7f3a; }
.id-msg.muted { color: #6b6590; }

/* Mobile: anchor profile dropdown to the viewport edge so it can never clip off-screen */
@media (max-width:640px){
  .drop-menu{position:fixed;top:56px;right:16px;left:auto;min-width:220px;
    max-width:calc(100vw - 32px);border:1px solid #d8dee4;
    box-shadow:0 8px 24px rgba(0,0,0,.18)}
}
