/*
 * Stage B components (queue, posts, post view, sources, sheets, notifications, login). Load order: tokens.css → components.css → layout.css → stage-b.css → skin.css.
 * Structure follows the airy revision: summary first, details behind a tap.
 */

/* ---------- generic airy section header ---------- */
.vhead { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding-block: 8px 18px; }
.vhead h1 { margin: 0; font-size: 34px; font-weight: 800; line-height: 1.05; letter-spacing: -.015em; }
.vhead p { margin: 6px 0 0; font-size: var(--t-sm); color: var(--muted); }
.vhead p b { color: var(--mint); }
.sec-t { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 28px 0 12px; font-size: var(--t-sm); font-weight: 800; color: var(--fg-2); }
.sec-t span { font-weight: 600; color: var(--muted); font-size: var(--t-xs); }

/* ---------- in progress (queue) ---------- */
.budget { display: grid; gap: 8px; padding: 14px 16px; border-radius: 16px; background: var(--surface); margin-bottom: 8px; }
.budget-top { display: flex; justify-content: space-between; font-size: var(--t-sm); color: var(--fg-2); }
.budget-top b { color: var(--fg); font-variant-numeric: tabular-nums; }
.meter { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.meter i { display: block; height: 100%; width: var(--v, 50%); border-radius: 4px; background: var(--mint); }
.meter.warn i { background: var(--warn); }
.jlist { display: grid; gap: 12px; }
.jcard { display: grid; gap: 10px; padding: 16px; border-radius: 18px; background: var(--surface); text-decoration: none; color: inherit; }
.jcard.run { background: linear-gradient(180deg, var(--mint-soft), transparent 70%) var(--surface); box-shadow: inset 0 0 0 1px var(--mint-line); }
.jcard.fail { background: var(--bad-soft); box-shadow: inset 0 0 0 1px rgba(255, 126, 112, .35); }
.j-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; font-weight: 700; color: var(--fg-2); }
.j-title { font-size: var(--t-md); font-weight: 700; line-height: 1.35; }
.j-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; font-size: 12.5px; color: var(--muted); }
.j-foot .eta { color: var(--fg-2); }
.j-err { margin: 0; font-size: var(--t-sm); color: var(--fg); line-height: 1.55; }
.j-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.steps li { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--surface-3); color: var(--muted); }
.steps li.done { color: var(--fg-2); }
.steps li.done::before { content: "✓ "; color: var(--mint); }
.steps li.now { background: var(--mint); color: var(--mint-ink); }
.live { display: inline-flex; align-items: center; gap: 6px; color: var(--mint); }
.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--mint); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.qpos { color: var(--muted); font-variant-numeric: tabular-nums; }
.dlist { list-style: none; margin: 0; padding: 0; }
.dlist li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; padding: 14px 0; border-bottom: 1px solid var(--line); font-size: var(--t-sm); }
.dlist li:last-child { border-bottom: 0; }
.dmeta { color: var(--muted); font-size: 12.5px; display: inline-flex; gap: 5px; align-items: center; white-space: nowrap; }

/* ---------- posts grid ---------- */
.pgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 14px; }
.pcard { display: grid; gap: 8px; text-decoration: none; color: inherit; }
.pthumb { position: relative; display: block; aspect-ratio: 4 / 5; border-radius: 14px; overflow: hidden; background: var(--surface-2); }
.pthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pcard.sel .pthumb { box-shadow: 0 0 0 2px var(--mint); }
.ptag { position: absolute; top: 8px; inset-inline-start: 8px; padding: 3px 9px; border-radius: 999px; background: var(--overlay); color: #fff; font-size: 11px; font-weight: 700; }
.ptitle { font-size: var(--t-sm); font-weight: 700; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pmeta { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }

/* ---------- post view ---------- */
.pv { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; max-width: 640px; margin-inline: auto; padding-block: 4px 40px; }   /* minmax: the 1080 px slides must not size the track */
.car { position: relative; }
.car-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; border-radius: 10px; direction: ltr; }   /* swipe like Instagram: left = next (approved, not RTL) */
.car-track::-webkit-scrollbar { display: none; }
.slide-c { position: relative; flex: 0 0 100%; aspect-ratio: 4 / 5; scroll-snap-align: center; background: var(--media-bg); }
.slide-c img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vbadge { position: absolute; top: 10px; right: 10px; padding: 4px 10px; border-radius: 999px; background: var(--overlay); color: #fff; font-size: 12px; font-weight: 700; box-shadow: inset 0 0 0 1px var(--mint-line); direction: rtl; }
.upd-badge { position: absolute; bottom: 10px; right: 10px; padding: 3px 9px; border-radius: 999px; background: var(--mint); color: var(--mint-ink); font-size: 11.5px; font-weight: 800; }
.car-under { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 12px; font-size: 12px; color: var(--muted); }
.dots { display: flex; gap: 6px; direction: ltr; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--line-2); }
.dots i.on { background: var(--mint); transform: scale(1.3); }
.dots i.warn { background: var(--warn); }
/* fallback slide (decision 45): navy, no photo, with a warning chip */
.fb { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 10%; background: var(--slide-navy); color: #fff; box-shadow: inset 0 0 0 4px var(--mint); }
.fb b { display: block; font-size: 15px; }
.fb-chip { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); white-space: nowrap; padding: 5px 12px; border-radius: 999px; background: var(--warn); color: var(--warn-ink); font-size: 12.5px; font-weight: 800; direction: rtl; }
.pv-info { display: grid; gap: 22px; }
/* one-column stacks: pin the track, or the 3-button row's max-content (≈430 px) widens it past a 390 phone */
.pv-info, .pv-state, .pv-acts { grid-template-columns: minmax(0, 1fr); }
.pv-state { display: grid; gap: 6px; }
.pv-state h2 { margin: 0; font-size: var(--t-xl); font-weight: 800; }
.pv-src { font-size: var(--t-sm); color: var(--muted); }
.pv-acts { display: grid; gap: 10px; }
.pv-acts .btn.primary { min-height: 52px; border-radius: 14px; font-size: var(--t-md); }
.pv-acts .row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.pv-acts .row3 .btn { flex-direction: column; min-height: 62px; gap: 2px; white-space: normal; text-align: center; line-height: 1.2; padding: 6px; }
.pv-acts .row3 .em { font-size: 18px; line-height: 1; }
.pv-acts .row3 small { font-size: 11px; color: var(--muted); font-weight: 500; }
.caption { padding: 16px; border-radius: 14px; background: var(--surface); font-size: var(--t-sm); line-height: 1.8; user-select: text; -webkit-user-select: text; }
.caption p { margin: 0 0 12px; } .caption p:first-child { font-weight: 800; font-size: var(--t-md); } .caption p:last-child { margin: 0; }
.ck-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ck { display: grid; grid-template-columns: 24px 22px minmax(0, 1fr); gap: 8px; align-items: start; padding: 12px 14px; border-radius: 14px; background: var(--surface); font-size: var(--t-sm); line-height: 1.6; cursor: pointer; }
.ck input { width: 22px; height: 22px; margin: 0; accent-color: var(--mint); }
.ck.done { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.ck.done .ck-t { color: var(--muted); }
.ck-t em { display: block; font-style: normal; font-size: 12px; color: var(--mint); margin-top: 2px; }
.cr-list { list-style: none; margin: 0; padding: 0; }
.cr { display: grid; grid-template-columns: 34px 22px minmax(0, 1fr); gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: var(--t-sm); line-height: 1.55; }
.cr:last-child { border-bottom: 0; }
.cr .n { font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.cr a { color: var(--mint); }
.legend { margin: 10px 0 0; font-size: 12px; color: var(--muted); }
.op-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.op { display: grid; gap: 6px; padding: 14px; border-radius: 14px; background: var(--surface); font-size: var(--t-sm); line-height: 1.55; }
.op-top { display: flex; align-items: center; gap: 8px; }
.op-kind { white-space: nowrap; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 800; background: var(--surface-3); color: var(--fg-2); }
.op-kind.media { background: var(--warn-soft); color: var(--warn); }
.op-kind.claim { background: var(--info-soft); color: var(--info); }
.op-kind.conflict { background: var(--violet-soft); color: var(--violet); }
.op-why { color: var(--muted); font-size: 12.5px; }
.op .btn { justify-self: start; }
/* thread messages new in stage B */
.topts { display: grid; gap: 8px; margin-top: 8px; }
.topt { display: grid; gap: 2px; padding: 12px 14px; border-radius: 14px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-ctl); text-align: start; min-height: var(--tap); }
.topt b { font-size: var(--t-md); font-weight: 800; line-height: 1.35; }
.topt span { font-size: 12.5px; color: var(--muted); }
.topt:hover, .topt[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--mint); }
.diff { display: grid; gap: 4px; margin-top: 8px; padding: 10px 12px; border-radius: 12px; background: var(--surface); font-size: 12.5px; }
.diff del { color: var(--muted); }
.diff ins { text-decoration: none; color: var(--mint); font-weight: 700; }

/* ---------- sources ---------- */
.addbox { display: grid; gap: 8px; padding: 16px; border-radius: 18px; background: var(--surface); }
.addbox label { font-weight: 800; font-size: var(--t-sm); }
.addbox .row { align-items: stretch; }
.hint { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.55; }
.slist { list-style: none; margin: 0; padding: 0; border-radius: 18px; background: var(--surface); overflow: hidden; }
.srow { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.srow:last-child { border-bottom: 0; }
.srow.off .s-name, .srow.off .s-ic { opacity: .45; }
.s-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-3); font-size: 18px; }
.s-name { font-weight: 700; font-size: var(--t-sm); display: flex; align-items: center; gap: 6px; }
.s-meta { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tier { padding: 1px 7px; border-radius: 6px; font-size: 11px; font-weight: 800; background: var(--surface-3); color: var(--fg-2); min-height: 0; position: relative; }
.tier::after { content: ""; position: absolute; inset: -13px -8px; }
.srow.pending { background: var(--violet-soft); grid-template-columns: 40px minmax(0, 1fr); }
.srow.pending .s-meta { color: var(--violet); white-space: normal; }
.srow.pending .p-acts { grid-column: 1 / -1; display: flex; gap: 8px; }
.switch { width: 50px; height: 30px; border-radius: 15px; background: var(--surface-3); box-shadow: inset 0 0 0 1.5px var(--line-ctl); position: relative; flex: none; }
.switch::before { content: ""; position: absolute; inset: -7px -2px; }    /* 44px target */
.switch::after { content: ""; position: absolute; top: 4px; inset-inline-start: 4px; width: 22px; height: 22px; border-radius: 50%; background: var(--fg-2); transition: inset-inline-start var(--dur-2); }
.switch[aria-checked="true"] { background: var(--mint); box-shadow: none; }
.switch[aria-checked="true"]::after { inset-inline-start: 24px; background: var(--mint-ink); }

/* ---------- sheets ---------- */
.sheet { position: fixed; inset: 0; z-index: var(--z-sheet); }
.sheet-bg { position: absolute; inset: 0; background: var(--scrim); }
.sheet-p { position: absolute; bottom: 0; left: 0; right: 0; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain; background: var(--surface); border-radius: 24px 24px 0 0;
  padding: 10px max(18px, var(--safe-r)) calc(20px + var(--safe-b)) max(18px, var(--safe-l)); }
.grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line-2); margin: 0 auto 12px; }
.sheet-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sheet-h h2 { margin: 0; font-size: var(--t-xl); font-weight: 800; }
.sheet-s { margin: 4px 0 0; color: var(--muted); font-size: var(--t-sm); line-height: 1.5; }
.sheet-b { display: grid; gap: 14px; margin-top: 18px; }
.types { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.type { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 0 14px; border-radius: 16px; background: var(--surface-2); font-weight: 700; font-size: var(--t-sm); position: relative; }
.type .em { font-size: 20px; }
.type[aria-checked="true"] { box-shadow: inset 0 0 0 2px var(--mint); background: var(--mint-soft); }
.type.wide { grid-column: 1 / -1; min-height: 64px; }
.type .new { margin-inline-start: auto; padding: 2px 8px; border-radius: 999px; background: var(--mint); color: var(--mint-ink); font-size: 11px; font-weight: 800; }
.type small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; }
.uploads { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.up { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--surface-3); }
.up img { width: 100%; height: 100%; object-fit: cover; display: block; }
.up .x { position: absolute; top: 4px; left: 4px; width: 26px; height: 26px; border-radius: 50%; background: var(--overlay); color: #fff; display: grid; place-items: center; font-size: 13px; }
.up .x::after { content: ""; position: absolute; inset: -9px; }
.up .vid { position: absolute; bottom: 4px; right: 4px; padding: 1px 6px; border-radius: 6px; background: var(--overlay); color: #fff; font-size: 10.5px; font-weight: 700; direction: ltr; }
.up.add { display: grid; place-items: center; background: transparent; box-shadow: inset 0 0 0 1.5px var(--line-ctl); color: var(--muted); font-size: 26px; border-radius: 12px; }
.choice { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 10px; align-items: start; padding: 14px 16px; border-radius: 16px; background: var(--surface-2); cursor: pointer; }
.choice input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--mint); }
.choice b { display: block; font-size: var(--t-md); }
.choice span { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.choice:has(input:checked) { box-shadow: inset 0 0 0 2px var(--mint); background: var(--mint-soft); }
.quick { display: flex; flex-wrap: wrap; gap: 8px; }
.qchip { display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); padding: 0 14px; border-radius: 999px; background: var(--mint-soft); color: var(--mint); font-weight: 800; font-size: var(--t-sm); box-shadow: inset 0 0 0 1px var(--mint-line); }
.sheet-foot { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; margin-top: 4px; }
.sheet-foot .btn.primary { min-height: 52px; border-radius: 14px; font-size: var(--t-md); }
.sheet-foot .btn.ghost { min-height: 52px; }

/* ---------- notifications ---------- */
.push { position: fixed; z-index: var(--z-push); top: calc(var(--safe-t) + 10px); left: max(10px, var(--safe-l)); right: max(10px, var(--safe-r)); max-width: 430px; margin-inline: auto;
  display: flex; border-radius: 20px; background: var(--glass); -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4); box-shadow: var(--shadow); border: 1px solid var(--glass-line); }
.push-c { flex: 1; display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 11px; padding: 12px 14px; min-width: 0; align-items: center; text-decoration: none; color: inherit; }
.push-c img { width: 40px; height: 40px; border-radius: 10px; }
.push-t { display: flex; flex-direction: column; min-width: 0; font-size: var(--t-sm); line-height: 1.35; }
.push-app { font-size: 11.5px; color: var(--muted); }
.push-b { color: var(--fg-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.push-x { width: var(--tap); color: var(--muted); display: grid; place-items: center; }
.nlist { list-style: none; margin: 0; padding: 0; }
.nrow { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: var(--t-sm); }
.nrow:last-child { border-bottom: 0; }
.nrow .em { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); font-size: 18px; }
.nrow.unread .em { background: var(--mint-soft); }
.nrow b { display: block; }
.nrow span { color: var(--muted); font-size: 12.5px; }
.setrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; border-bottom: 1px solid var(--line); font-size: var(--t-sm); font-weight: 600; }
.setrow:last-child { border-bottom: 0; }
.setrow small { display: block; color: var(--muted); font-weight: 500; font-size: 12px; }

/* ---------- login ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: calc(32px + var(--safe-t)) max(24px, var(--safe-r)) calc(32px + var(--safe-b)) max(24px, var(--safe-l)); background: radial-gradient(120% 70% at 50% 0%, rgba(100, 247, 203, .1), transparent 60%), var(--bg); }
.login-in { width: min(380px, 100%); display: grid; gap: 16px; justify-items: center; text-align: center; }
.login-av { width: 112px; height: 112px; border-radius: 28px; box-shadow: 0 16px 40px rgba(100, 247, 203, .18); }
.login h1 { margin: 6px 0 0; font-size: 30px; font-weight: 900; }
.login p { margin: 0; color: var(--muted); font-size: var(--t-sm); line-height: 1.6; }
.login .btn.primary { width: 100%; min-height: 56px; border-radius: 16px; font-size: var(--t-md); }
.login .btn.ghost { width: 100%; }
.login .fine { font-size: 12px; color: var(--muted); }
/* after a failed sign-in: what happened (b) + what to do; calm, not alarming */
.login .help { width: 100%; padding: 12px 16px; border-radius: 14px; background: var(--bad-soft); color: var(--fg-2); }
.login .help b { display: block; color: var(--bad); font-weight: 800; margin-bottom: 2px; }
/* Safari sizes a centred grid item to its unwrapped text, so long text spills off the side instead of wrapping.
   Text children get a definite width; text-align keeps them centred. (Found on Nadav's iPhone, login subtitle.) */
.login-in > :is(p, h1, h2), .state > :is(h1, h2, h3), .fb > * { justify-self: stretch; min-width: 0; max-width: 100%; overflow-wrap: anywhere; }

@media (min-width: 720px) {
  .sheet-p { left: 50%; right: auto; bottom: auto; top: 50%; transform: translate(-50%, -50%); width: min(560px, calc(100vw - 48px)); border-radius: 24px; padding: 24px 26px 26px; box-shadow: var(--shadow); }
  .grab { display: none; }
  .pgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 960px) {
  .pane-list .pgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pv { max-width: 1040px; grid-template-columns: minmax(0, 400px) minmax(0, 1fr); align-items: start; gap: 36px; }
  .pv-media { position: sticky; top: 72px; }
}
@media (prefers-reduced-motion: reduce) { .live::before { animation: none; } }
@media (min-width: 960px) { .pane-detail .d-body:has(.pv) { max-width: 1080px; } }
/* media-dropped option (SPEC §5.6, CONTENT_VOICE §12.1.1): which slide lost which image, why, and 5 alternatives as buttons */
.op.drop { background: var(--warn-soft); box-shadow: inset 0 0 0 1px rgba(255, 200, 97, .3); }
.op.drop .op-why { color: var(--fg-2); }   /* muted is 4.26:1 on the warm fill; fg-2 passes */
.op-kind.drop { background: var(--warn); color: var(--warn-ink); }
.alts { display: grid; gap: 6px; margin-top: 4px; }
.alt { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 10px; align-items: center; min-height: var(--tap); padding: 8px 12px; border-radius: 12px; background: var(--surface); text-align: start; font-size: var(--t-sm); font-weight: 600; }
.alt i { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 12px; font-weight: 800; background: var(--surface-3); color: var(--fg-2); }
.alt small { display: block; font-weight: 500; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alt:hover { background: var(--surface-2); }
.alt[aria-checked="true"] { box-shadow: inset 0 0 0 2px var(--mint); }
.alt[aria-checked="true"] i { background: var(--mint); color: var(--mint-ink); }
