/* Consumer app page: stage layout, phone frame, screens, extension popup */

.stage {
  display: grid; gap: 32px; padding: 32px 24px 64px; justify-content: center; align-items: start;
  grid-template-columns: 390px;
  grid-template-areas: "phone" "ext" "rev";
}
@media (min-width: 900px) {
  .stage { grid-template-columns: 390px 360px; grid-template-areas: "phone ext" "rev rev"; }
}
@media (min-width: 1240px) {
  .stage { grid-template-columns: 280px 390px 360px; grid-template-areas: "rev phone ext"; }
}
@media (max-width: 440px) {
  .stage { padding: 16px 0 48px; grid-template-columns: 100%; }
  .phone { border-radius: 0 !important; border-width: 0 !important; width: 100% !important; }
}

/* ---------- reviewer ---------- */
.reviewer { grid-area: rev; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 18px; align-content: start; }
@media (min-width: 1240px) { .reviewer { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; } }
.rv-title { font-size: 1.4rem; margin: 0; }
.rv-h { font: 700 .75rem/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); margin: 0 0 8px; }
.rv-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.rv-list button { width: 100%; text-align: left; padding: 7px 10px; border-radius: 8px; border: 0; background: none; color: var(--ink); font: 500 .86rem var(--sans); cursor: pointer; }
.rv-list button:hover { background: var(--surface-2); }
.rv-list button[aria-current="true"] { background: var(--surface-2); font-weight: 700; box-shadow: inset 3px 0 0 var(--gold); }
.rv-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.rv-btns .btn[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); }
.rv-grid { display: grid; gap: 6px; }
.rv-check { display: flex; align-items: center; gap: 8px; font-size: .85rem; margin-top: 8px; }

/* ---------- phone ---------- */
.phone-col { grid-area: phone; }
.phone {
  position: relative; width: 390px; height: 844px; border-radius: 52px; overflow: hidden;
  background: var(--bg); border: 10px solid #0D1522; box-shadow: 0 30px 80px rgb(14 24 38 / .35), 0 0 0 2px #2A3A52;
  display: flex; flex-direction: column; color: var(--ink);
}
.statusbar { flex: none; height: 44px; display: flex; align-items: center; justify-content: space-between; padding: 0 26px; font: 600 .85rem var(--sans); position: relative; }
.statusbar .notch { position: absolute; left: 50%; top: 8px; transform: translateX(-50%); width: 112px; height: 30px; border-radius: 20px; background: #0D1522; }
.sb-icons { font-size: .62rem; letter-spacing: 1px; }
.screens { flex: 1; overflow-y: auto; overflow-x: hidden; position: relative; scrollbar-width: thin; }
.screen { padding: 8px 18px 24px; min-height: 100%; }
.screen.onb { display: flex; flex-direction: column; padding-bottom: 20px; }
.screen.onb[hidden] { display: none; }
.tabbar { flex: none; display: grid; grid-template-columns: repeat(5, 1fr); padding: 6px 6px 22px; border-top: 1px solid var(--line); background: var(--surface); }
.tabbar button { display: grid; justify-items: center; gap: 2px; padding: 6px 0; border: 0; background: none; color: var(--ink-2); font: 600 .68rem var(--sans); cursor: pointer; border-radius: 10px; }
.tabbar button .i { width: 22px; height: 22px; }
.tabbar button[aria-current="page"] { color: var(--primary); }
.tabbar button[aria-current="page"] .i { stroke-width: 2.4; }

.topbar { display: flex; align-items: center; justify-content: space-between; margin: 0 -8px 8px; }
.apphead { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin: 4px 0 14px; }
.h-screen { font-size: 1.6rem; margin: 0; }
.sec-h { font: 700 .78rem/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); margin: 22px 0 8px; }
.d-block { display: block; }
.list.card { padding: 0 14px; }
.avatar { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--navy); color: var(--cream); font: 600 1.6rem var(--serif); flex: none; background-size: cover; }
.avatar.sm { width: 40px; height: 40px; font-size: 1rem; }
.err-text { color: var(--danger); display: flex; gap: 6px; align-items: flex-start; }

/* onboarding */
.onb-hero { position: relative; height: 230px; margin: 0 -18px; background: var(--navy); display: grid; place-items: center; overflow: hidden; }
.onb-hero .ros { position: absolute; inset: -40px; }
.onb-hero .ros svg { width: 100%; height: 100%; }
.onb-hero > span { position: relative; color: var(--cream); }
.onb-hero .stamp { color: var(--gold); }
.onb-body { flex: 1; padding-top: 18px; }
.onb-title { font-size: 1.75rem; }
.onb-foot { display: grid; gap: 8px; }
.dots { display: flex; gap: 6px; justify-content: center; margin-bottom: 6px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--surface-3); }
.dots i.on { background: var(--primary); width: 22px; border-radius: 4px; }
.ticks { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 10px; }
.ticks li { display: flex; gap: 10px; align-items: center; }
.ticks .i { color: var(--primary); }
.photo-pick { display: flex; gap: 14px; align-items: center; }
.mrz-light { background: var(--surface-2); color: var(--ink); white-space: pre; font-size: .66rem; }

/* pair card */
.pair-stage { margin-top: 16px; padding: 16px; border-radius: 16px; background: var(--surface-2); background-image: var(--guilloche-ink); text-align: center; }
.pair-art { width: 100%; max-width: 260px; height: auto; }
.pair-art .pwaves path { fill: none; stroke: #C99A2A; stroke-width: 3; stroke-linecap: round; opacity: 0; }
.pair-art .pcard { transition: transform .6s ease; transform: translate(-6px, 18px) rotate(-6deg); transform-origin: 80px 110px; }
.pair-art .pbadge { opacity: 0; }
.pair-art .pbadge circle { stroke: none; }
.pair-art .pbadge path { fill: none; stroke: #fff; stroke-width: 4; stroke-linecap: round; display: none; }
[data-pstate="waiting"] .pcard { animation: pair-bob 2.4s ease-in-out infinite; }
[data-pstate="waiting"] .pwaves path { animation: pwave 2.4s ease-out infinite; }
[data-pstate="waiting"] .pwaves path:nth-child(2) { animation-delay: .2s; }
[data-pstate="waiting"] .pwaves path:nth-child(3) { animation-delay: .4s; }
[data-pstate="reading"] .pcard, [data-pstate="paired"] .pcard, [data-pstate="failed"] .pcard { transform: translate(40px, -20px) rotate(0); }
[data-pstate="reading"] .pwaves path { animation: pwave .9s ease-out infinite; }
[data-pstate="reading"] .pwaves path:nth-child(2) { animation-delay: .15s; }
[data-pstate="reading"] .pwaves path:nth-child(3) { animation-delay: .3s; }
[data-pstate="paired"] .pbadge, [data-pstate="failed"] .pbadge { opacity: 1; }
[data-pstate="paired"] .pbadge circle { fill: var(--green); }
[data-pstate="paired"] .pb-ok { display: block !important; }
[data-pstate="failed"] .pbadge circle { fill: var(--danger-fill); }
[data-pstate="failed"] .pb-x { display: block !important; }
[data-pstate="failed"] .pcard { transform: translate(10px, 10px) rotate(-12deg); }
@keyframes pair-bob { 0%, 100% { transform: translate(-6px, 18px) rotate(-6deg); } 50% { transform: translate(30px, -10px) rotate(-1deg); } }
@keyframes pwave { 0%, 40% { opacity: 0; } 55% { opacity: .9; } 100% { opacity: 0; } }
.pair-status { margin: 8px 0 0; font-weight: 600; display: flex; justify-content: center; }

/* wiggle practice */
.wiggle-practice { display: grid; justify-items: center; gap: 12px; margin-top: 12px; }
.practice-pad { width: 100%; padding: 10px; border-radius: 14px; background: var(--surface-2); background-image: var(--guilloche-ink); }

/* home */
.cover { position: relative; overflow: hidden; border-radius: 16px; padding: 18px; color: var(--cream); background: linear-gradient(150deg, #1F3A5F, #15294A); box-shadow: 0 12px 30px rgb(31 58 95 / .35); }
.cover .ros { position: absolute; right: -70px; top: -70px; width: 280px; height: 280px; pointer-events: none; }
.cover .ros svg { width: 100%; height: 100%; }
.cover > * { position: relative; }
.cover-top { display: flex; justify-content: space-between; gap: 8px; }
.cover-kicker { font: 700 .7rem var(--mono); letter-spacing: .14em; text-transform: uppercase; color: #F2C14E; margin: 0 0 6px; }
.cover-name { font: 600 1.55rem/1.1 var(--serif); margin: 0; }
.cover-no { font-size: .78rem; opacity: .85; margin: 4px 0 0; }
.cover .stamp-green { color: #9EE0B1; }
.cover-meta { display: flex; gap: 14px; flex-wrap: wrap; font-size: .78rem; margin: 10px 0; opacity: .92; }
.cover-meta .i { color: #F2C14E; }
.cover .mrz { font-size: .6rem; padding: 6px 8px; }
.cover.frozen { filter: grayscale(.7); }
.alerts .status { padding: 6px; }
.demo-card { margin-top: 18px; background: var(--surface-2); background-image: var(--guilloche-ink); }

/* timeline */
.day-h { font: 700 .75rem var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); margin: 18px 0 6px; position: sticky; top: 0; background: var(--bg); padding: 4px 0; z-index: 1; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px dashed var(--line); margin-left: 8px; }
.timeline li { position: relative; }
.timeline li::before { content: ""; position: absolute; left: -24px; top: 22px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--primary); }
.timeline li[data-kind="verify"]::before { border-color: var(--green); background: var(--green); }
.timeline li[data-kind="agent"]::before { border-color: #B88A1C; }
.timeline li[data-kind="failed"]::before { border-color: var(--danger-fill); background: var(--danger-fill); }
.tl-item { display: flex; gap: 10px; width: 100%; text-align: left; padding: 10px 8px; border: 0; background: none; color: inherit; font: inherit; border-radius: 10px; cursor: pointer; align-items: flex-start; }
.tl-item:hover { background: var(--surface-2); }
.tl-item .meta { font-size: .78rem; color: var(--ink-2); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 2px; }
.tl-item strong { display: block; font-size: .92rem; }
.tl-item .status { font-size: .72rem; padding: 2px 7px 2px 5px; }

/* sheets */
.sheet-backdrop { position: absolute; inset: 0; background: rgb(14 24 38 / .5); z-index: 20; animation: fade .2s ease; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; z-index: 21; max-height: 92%; overflow-y: auto; background: var(--surface); border-radius: 22px 22px 0 0; padding: 8px 18px 28px; box-shadow: 0 -10px 40px rgb(0 0 0 / .25); animation: sheet-up .28s cubic-bezier(.2,.9,.3,1); }
.grabber { width: 40px; height: 5px; border-radius: 3px; background: var(--surface-3); margin: 0 auto 12px; }
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }
.sheet .vs-head .what { font-size: 1.1rem; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: .88rem; margin: 0; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; }

/* vault */
#vault-panels > [role="tabpanel"] { padding-top: 12px; }
.pref-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.pref-row.col { flex-direction: column; align-items: flex-start; }
.pref-row .hint { margin: 0; }
.mem-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; }
.mem-row input { min-height: 36px; padding: 6px 10px; }
.data-site { padding: 12px; }
.data-site .tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.tag { font-size: .75rem; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }

/* agents */
.agent-card { padding: 14px; }
.agent-card .perm { display: grid; gap: 6px; padding: 10px 0; border-top: 1px solid var(--line); }
.agent-card .perm-top { display: flex; justify-content: space-between; align-items: center; }
.agent-card .seg { width: 100%; }
.agent-card .seg label { flex: 1; justify-content: center; padding: 6px 4px; }
.agent-limits { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.agent-log { margin-top: 10px; }
.agent-card.paused .perm, .agent-card.paused .agent-limits { opacity: .5; }

/* site detail */
.site-head { display: flex; gap: 12px; align-items: center; margin-bottom: 4px; }
.claim-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; }
.claim-row .grow strong { display: block; font-size: .92rem; }

/* recovery */
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 0; margin: 4px 0; list-style: none; counter-reset: c; }
.codes li { font-family: var(--mono); font-size: .85rem; padding: 6px 8px; border-radius: 8px; background: var(--surface-2); counter-increment: c; }
.codes li::before { content: counter(c) ". "; color: var(--ink-2); }
.codes li.used { text-decoration: line-through; color: var(--ink-2); }

/* ---------- extension popup ---------- */
.ext-col { grid-area: ext; width: 360px; max-width: 100%; justify-self: center; }
@media (max-width: 440px) { .ext-col { width: calc(100% - 24px); } }
.ext-label { margin: 0 0 8px; }
.ext-browser { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px 12px 0 0; background: var(--surface-3); font-size: .75rem; }
.ext-browser .dotrow { display: flex; gap: 5px; }
.ext-browser .dotrow i { width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.ext-browser .urlbar { flex: 1; background: var(--surface); border-radius: 6px; padding: 3px 8px; color: var(--ink-2); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ext-pin { font: 700 .65rem var(--mono); background: var(--navy); color: var(--gold); padding: 3px 5px; border-radius: 5px; }
.ext { width: 100%; height: 600px; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 0 0 14px 14px; padding: 0 16px 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.ext-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; margin: 0 -16px 12px; background: var(--navy); color: var(--cream); position: relative; }
.ext-head::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: var(--guilloche); }
.ext-head .brand-mini { font: 600 1rem var(--serif); }
.ext-head .ext-link { color: var(--cream); }
.ext-head :focus-visible { outline-color: var(--gold); }
.ext-site { display: flex; gap: 12px; align-items: center; }
.ext-title { font-size: 1.3rem; margin: 0; }
.ext-note { display: flex; gap: 6px; align-items: center; color: var(--ink-2); margin: 10px 0 0; }
.ext-verify { margin-top: auto; padding: 12px; border-radius: 12px; background: var(--surface-2); background-image: var(--guilloche-ink); display: grid; gap: 8px; }
.ext-verify p { margin: 0; }
.ext-foot { margin-top: 10px; }
.ext.paused .ext-site, .ext.paused #ext-claims { opacity: .5; }
