/* Collection / swaps / inbox / profile. Strict CSP: every visual state is a
   class; progress widths use the w-0 … w-100 ladder below (5% steps). */

/* Progress ladder */
.progress { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin: 6px 0; }
.progress-lg { height: 12px; }
.progress-bar { height: 100%; background: var(--accent); border-radius: 999px; transition: width 0.3s ease; width: 0; }
.progress-bar.is-complete { background: var(--green); }
.w-0 { width: 0; } .w-5 { width: 5%; } .w-10 { width: 10%; } .w-15 { width: 15%; } .w-20 { width: 20%; }
.w-25 { width: 25%; } .w-30 { width: 30%; } .w-35 { width: 35%; } .w-40 { width: 40%; } .w-45 { width: 45%; }
.w-50 { width: 50%; } .w-55 { width: 55%; } .w-60 { width: 60%; } .w-65 { width: 65%; } .w-70 { width: 70%; }
.w-75 { width: 75%; } .w-80 { width: 80%; } .w-85 { width: 85%; } .w-90 { width: 90%; } .w-95 { width: 95%; } .w-100 { width: 100%; }

/* Binder */
.binder-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 0 0 18px; }
.binder-stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; box-shadow: var(--shadow); }
.binder-stat dt { font-size: 0.78rem; color: var(--muted); font-weight: 600; }
.binder-stat dd { margin: 2px 0 0; font-size: 1.4rem; font-weight: 800; letter-spacing: -0.02em; }
.binder-stat dd small { font-size: 0.8rem; font-weight: 500; }
.binder-add { margin-bottom: 8px; }
.binder-add-row { grid-template-columns: minmax(220px, 2fr) repeat(4, minmax(110px, 1fr)) auto; align-items: end; }
.binder-add-submit { align-self: end; }
@media (max-width: 900px) { .binder-add-row { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); } .binder-add-card { grid-column: 1 / -1; } }
.binder-tile { display: flex; flex-direction: column; gap: 6px; }
.binder-tile .card-tile { flex: 1; }
.binder-tile-meta { display: flex; flex-wrap: wrap; gap: 6px; font-size: 0.75rem; align-items: center; min-height: 1em; }
.binder-tile-actions { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.binder-tile-actions .btn-sm { padding: 5px 9px; min-width: 32px; }
.binder-qty { font-weight: 800; min-width: 24px; text-align: center; }
.binder-tile.is-missing .card-tile { opacity: 0.55; filter: grayscale(0.6); }
.binder-tile.is-missing .card-tile:hover { opacity: 1; filter: none; }
.binder-tile.is-secret .card-tile-meta::after { content: ' · secret'; }
.set-progress-item { display: flex; align-items: center; gap: 14px; }
.set-progress-symbol { width: 28px; height: 28px; object-fit: contain; flex: none; }
.set-progress-body { flex: 1; min-width: 0; }
.set-progress-name { font-weight: 700; margin-right: 8px; }
.set-progress-count { text-align: right; font-size: 0.9rem; min-width: 64px; }
.set-hero { display: flex; gap: 20px; align-items: flex-start; }
.set-hero-logo { width: 160px; height: auto; object-fit: contain; flex: none; }
.set-hero-body { flex: 1; min-width: 0; }
.set-hero-body h1 small { font-size: 0.6em; font-weight: 500; }
.set-hero-count { font-size: 1.1rem; }
@media (max-width: 640px) { .set-hero { flex-direction: column; } .set-hero-logo { width: 120px; } }

/* Swap board */
.section-gap { margin-top: 28px; }
.swap-intro .steps { margin-bottom: 18px; }
.member-chip { display: inline-flex; align-items: center; gap: 8px; color: inherit; flex-wrap: wrap; }
.member-chip:hover { text-decoration: none; }
.swap-match-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.swap-match-head .btn { margin-left: auto; }
.swap-match-cols { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }
.swap-match-cols h3 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 8px; }
@media (max-width: 640px) { .swap-match-cols { grid-template-columns: 1fr; } }
.mini-list { display: grid; gap: 6px; }
.mini-card { display: flex; align-items: center; gap: 10px; color: inherit; padding: 4px 6px; border-radius: var(--radius-sm); }
.mini-card:hover { background: var(--surface-2); text-decoration: none; }
.mini-card img { width: 36px; height: 50px; object-fit: contain; border-radius: 3px; background: var(--surface-2); flex: none; }
.mini-card-placeholder { width: 36px; height: 50px; display: flex; align-items: center; justify-content: center; background: var(--surface-2); border-radius: 3px; font-weight: 800; color: var(--muted); flex: none; }
.mini-card-body { display: grid; gap: 1px; min-width: 0; }
.mini-card-name { font-weight: 600; font-size: 0.92rem; }
.mini-card-meta { font-size: 0.78rem; }

/* Proposal builder */
.swap-cols { align-items: start; grid-template-columns: 1fr 1fr; }
@media (max-width: 800px) { .swap-cols { grid-template-columns: 1fr; } }
.swap-side { margin-bottom: 0; }
.swap-side h2 { display: flex; align-items: baseline; gap: 8px; }
.swap-side-total { font-size: 0.85rem; font-weight: 500; }
.swap-picks { display: grid; gap: 6px; max-height: 520px; overflow: auto; padding-right: 4px; }
.swap-pick { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.swap-pick.is-wanted { border-color: #bfe8d0; background: #f4fbf7; }
.swap-pick:has(.swap-pick-check:checked) { border-color: var(--accent); background: var(--accent-soft); }
.swap-pick-check { width: 18px; height: 18px; flex: none; }
.swap-pick-label { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; cursor: pointer; }
.swap-pick-label img { width: 36px; height: 50px; object-fit: contain; border-radius: 3px; background: var(--surface-2); flex: none; }
.swap-pick-body { display: grid; gap: 1px; min-width: 0; font-size: 0.9rem; }
.swap-pick-body .muted { font-size: 0.78rem; }
.swap-pick-name { font-weight: 600; }
.swap-pick-qty { width: 64px; flex: none; padding: 6px 8px; }
.swap-fairness { font-weight: 600; }

/* Proposal page */
.swap-parties { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: start; }
.swap-arrow { font-size: 1.8rem; color: var(--muted); padding-top: 40px; }
@media (max-width: 700px) { .swap-parties { grid-template-columns: 1fr; } .swap-arrow { text-align: center; padding: 0; } }
.swap-party { margin-bottom: 0; }
.grid-cards-sm { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.swap-cash { font-weight: 800; font-size: 1.1rem; margin: 12px 0 0; }
.swap-fairness-box { margin-top: 18px; }
.swap-message { white-space: pre-wrap; }
.swap-actions .form { margin-bottom: 10px; }
.swap-cancel { margin-top: 16px; padding-top: 12px; border-top: 1px dashed var(--line); }
.handover-code { font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace; font-size: 2.2rem; letter-spacing: 0.3em; text-align: center; background: var(--ink); color: var(--accent); border-radius: var(--radius); padding: 18px 8px 18px 16px; margin: 8px 0; user-select: all; }
.handover-input { text-transform: uppercase; letter-spacing: 0.25em; font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace; font-size: 1.2rem; text-align: center; }

/* Inbox */
.narrow-wide { max-width: 820px; }
.inbox-item { padding: 0; }
.inbox-link { display: flex; gap: 14px; padding: 14px 16px; color: inherit; align-items: flex-start; }
.inbox-link:hover { text-decoration: none; background: var(--surface-2); border-radius: var(--radius); }
.inbox-body { display: grid; gap: 3px; flex: 1; min-width: 0; }
.inbox-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.inbox-time { margin-left: auto; font-size: 0.8rem; }
.inbox-context { font-size: 0.82rem; }
.inbox-preview { font-size: 0.92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-item.is-unread .inbox-preview { font-weight: 600; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }

/* Thread */
.thread-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.thread-context { display: flex; gap: 8px; flex-wrap: wrap; }
.thread-safety { margin: 0 0 14px; font-size: 0.9rem; }
.thread-messages { display: flex; flex-direction: column; gap: 10px; padding: 8px 0 16px; max-height: 60vh; overflow: auto; }
.msg { display: flex; flex-direction: column; align-items: flex-start; max-width: 78%; }
.msg.is-mine { align-self: flex-end; align-items: flex-end; }
.msg-bubble { background: var(--surface); border: 1px solid var(--line); border-radius: 16px 16px 16px 4px; padding: 10px 14px; white-space: pre-wrap; word-break: break-word; box-shadow: var(--shadow); }
.msg.is-mine .msg-bubble { background: var(--accent-soft); border-color: #f0dd8a; border-radius: 16px 16px 4px 16px; }
.msg-meta { font-size: 0.75rem; margin-top: 3px; padding: 0 4px; }
.thread-form { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; position: sticky; bottom: 8px; box-shadow: var(--shadow); }
.thread-form-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* Profile */
.profile-head { display: grid; grid-template-columns: auto 1fr auto; gap: 20px; align-items: start; }
@media (max-width: 760px) { .profile-head { grid-template-columns: auto 1fr; } .profile-rep { grid-column: 1 / -1; } }
.profile-head h1 { margin-bottom: 4px; }
.profile-head h1 small { font-size: 0.6em; font-weight: 500; }
.profile-facts { display: flex; gap: 14px; flex-wrap: wrap; font-size: 0.9rem; margin-bottom: 8px; }
.profile-badges { margin: 0 0 10px; }
.profile-bio { white-space: pre-wrap; max-width: 60ch; }
.profile-rep { display: grid; grid-template-columns: repeat(2, minmax(110px, 1fr)); gap: 10px; margin: 0; }
.profile-rep div { background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px; }
.profile-rep dt { font-size: 0.75rem; color: var(--muted); font-weight: 600; }
.profile-rep dd { margin: 0; font-size: 1.2rem; font-weight: 800; }
.rating-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.rating-stars { color: #d99a00; letter-spacing: 0.05em; font-size: 1.05rem; }
.rating-stars .muted { color: var(--line); }
