/* Screen-specific styles. Shared pieces live in components.css. */

body.bare .rail, body.bare .topbar, body.bare .bottom-nav { display: none; }
body.bare .app { display: block; }
body.bare .main { padding-bottom: 0; }

/* ---------- Home ---------- */
.hero { position: relative; overflow: hidden; padding: 20px 0 8px; }
.hero-inner { position: relative; z-index: 1; }
.hero-blob { position: absolute; border-radius: 50%; filter: blur(64px); opacity: 0.55; pointer-events: none; }
.hero-blob.b1 { width: 340px; height: 340px; background: var(--primary-200); top: -140px; right: -90px; animation: float-y 9s ease-in-out infinite; }
.hero-blob.b2 { width: 260px; height: 260px; background: var(--lost-100); bottom: -140px; left: -70px; animation: float-y 11s ease-in-out infinite reverse; }
:root[data-theme='dark'] .hero-blob { opacity: 0.22; }
.hello { font-weight: 700; color: var(--primary); font-size: 14px; }
.headline { font-size: clamp(30px, 6.4vw, 54px); line-height: 1.12; font-weight: 800; letter-spacing: -0.025em; margin: 6px 0 18px; }
.headline em { font-style: normal; color: var(--primary); }
.hero-search { max-width: 640px; }

.quick-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 20px; }
@media (min-width: 720px) { .quick-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.quick { display: grid; gap: 2px; padding: 16px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--divider); box-shadow: var(--sh-xs); transition: transform var(--t-base) var(--ease), box-shadow var(--t-base) var(--ease); }
.quick .q-ico { width: 46px; height: 46px; border-radius: 16px; display: grid; place-items: center; background: var(--ink); color: var(--on-ink); margin-bottom: 8px; transition: transform var(--t-base) var(--ease-spring); }
.quick .q-ico.found { background: var(--primary); color: var(--on-primary); }
.quick b { font-weight: 800; }
.quick small { color: var(--text-2); font-size: 12px; }
@media (hover: hover) { .quick:hover { transform: translateY(-3px); box-shadow: var(--sh-md); } .quick:hover .q-ico { transform: rotate(-8deg) scale(1.1); } }
.quick:active { transform: scale(0.97); }

.status-card { padding: 18px; display: grid; gap: 14px; }
.status-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.status-stats > div, .status-stats > a { display: grid; gap: 2px; padding: 12px 10px; border-radius: var(--r-md); background: var(--surface-soft); text-align: center; }
.status-stats b { font-size: 26px; font-weight: 800; line-height: 1.1; color: var(--primary); }
.status-stats span { font-size: 11px; font-weight: 700; color: var(--text-2); }
.station-mini-list { display: grid; gap: 4px; }
.station-mini { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-radius: var(--r-md); transition: background-color var(--t-fast); }
.station-mini:hover { background: var(--surface-soft); }
.station-mini .grow { flex: 1; min-width: 0; display: grid; gap: 1px; }
.station-mini .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--unknown); flex: none; }
.station-mini .dot.fresh { background: var(--fresh); }
.station-mini .dot.recent { background: var(--recent); }
.station-mini .dot.stale { background: var(--stale); }
.grow-btn { flex: 1; }
.h-card { width: 240px; }
@media (min-width: 720px) { .h-card { width: 260px; } }

/* ---------- Onboarding ---------- */
.onboarding { min-height: 100dvh; display: flex; flex-direction: column; max-width: 560px; margin: 0 auto; padding: calc(12px + var(--safe-t)) 20px calc(20px + var(--safe-b)); }
.ob-top { display: flex; align-items: center; justify-content: space-between; height: 48px; }
.ob-track { flex: 1; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; margin: 0 -20px; }
.ob-track::-webkit-scrollbar { display: none; }
.ob-slide { flex: none; width: 100%; scroll-snap-align: center; padding: 8px 28px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 14px; }
.ob-slide h1 { font-size: clamp(24px, 6vw, 30px); font-weight: 800; letter-spacing: -0.02em; line-height: 1.25; }
.ob-slide p { color: var(--text-2); max-width: 36ch; }
.ob-art { position: relative; width: 168px; height: 168px; border-radius: 56px; display: grid; place-items: center; margin-bottom: 18px; background: linear-gradient(145deg, var(--primary-100), var(--primary-200)); color: var(--primary); animation: float-y 5s ease-in-out infinite; }
.ob-art .ring { position: absolute; inset: 0; border-radius: inherit; border: 2px solid var(--primary); opacity: 0; animation: ob-ring 3.2s ease-out infinite; }
.ob-art .r2 { animation-delay: 1s; }
.ob-art .r3 { animation-delay: 2s; }
@keyframes ob-ring { 0% { transform: scale(0.9); opacity: 0.5; } 100% { transform: scale(1.5); opacity: 0; } }
.ob-foot { display: grid; gap: 14px; }
.ob-dots { display: flex; justify-content: center; gap: 6px; }
.ob-dots i { width: 8px; height: 8px; border-radius: 4px; background: var(--divider-strong); transition: width var(--t-base) var(--ease), background-color var(--t-base); }
.ob-dots i.on { width: 26px; background: var(--primary); }
.ob-terms { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--text-2); cursor: pointer; }
.ob-terms input { width: 20px; height: 20px; accent-color: var(--primary); flex: none; margin-top: 1px; }
.ob-stage { display: contents; }
/* Desktop: the slider becomes a centred card, artwork on the left and text on the right, with a regular-width button. */
@media (min-width: 900px) {
  .onboarding { max-width: 1080px; justify-content: center; gap: 12px; padding: 32px 48px; }
  .ob-top { height: 56px; padding: 0 8px; }
  .ob-stage { display: flex; flex-direction: column; height: min(600px, calc(100dvh - 140px)); min-height: 500px; padding: 24px 56px 36px; border-radius: 36px; background: var(--surface); border: 1px solid var(--divider); box-shadow: var(--sh-md); overflow: hidden; }
  .ob-track { margin: 0 -56px; }
  .ob-slide { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); grid-template-rows: auto auto; align-content: center; align-items: center; justify-items: start; column-gap: 72px; row-gap: 0; padding: 8px 56px; text-align: left; }
  .ob-art { grid-column: 1; grid-row: 1 / span 2; justify-self: center; width: 280px; height: 280px; border-radius: 88px; margin: 0; }
  .ob-art svg { width: 104px; height: 104px; }
  .ob-slide h1 { grid-column: 2; grid-row: 1; align-self: end; padding-bottom: 14px; font-size: clamp(34px, 3.4vw, 44px); text-wrap: balance; }
  .ob-slide p { grid-column: 2; grid-row: 2; align-self: start; max-width: 34ch; font-size: 18px; line-height: 1.65; text-wrap: pretty; }
  .ob-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 24px; }
  .ob-foot .notice, .ob-foot .ob-terms { flex: 1 1 100%; }
  .ob-foot .notice { order: -2; }
  .ob-foot .ob-terms { order: -1; }
  .ob-dots { justify-content: flex-start; }
  .ob-foot .btn.block { width: auto; min-width: 200px; }
}
@media (min-width: 900px) and (max-height: 720px) {
  .onboarding { padding-block: 16px; }
  .ob-stage { min-height: 460px; padding-block: 16px 28px; }
  .ob-art { width: 200px; height: 200px; border-radius: 64px; }
  .ob-art svg { width: 80px; height: 80px; }
}

/* ---------- Search ---------- */
.search-head { display: grid; gap: 12px; padding-top: 12px; position: sticky; top: calc(56px + var(--safe-t)); z-index: 20; background: color-mix(in srgb, var(--bg) 92%, transparent); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); padding-bottom: 8px; }
@media (min-width: 1024px) { .search-head { top: 0; padding-top: 24px; } }

/* ---------- Item detail ---------- */
.item-layout { display: grid; gap: 20px; padding-top: 4px; }
@media (min-width: 900px) { .item-layout { grid-template-columns: minmax(0, 1.5fr) minmax(320px, 1fr); gap: 32px; align-items: start; padding-top: 24px; } .item-side { position: sticky; top: 24px; } }
.item-side { display: grid; gap: 14px; }
.gallery { position: relative; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; border-radius: var(--r-xl); background: var(--surface-soft); aspect-ratio: 4 / 3; scrollbar-width: none; box-shadow: var(--sh-sm); }
.gallery::-webkit-scrollbar { display: none; }
@media (min-width: 900px) { .gallery { aspect-ratio: 16 / 11; } }
.g-slide { flex: none; width: 100%; height: 100%; scroll-snap-align: center; cursor: zoom-in; overflow: hidden; }
.g-slide img { width: 100%; height: 100%; object-fit: cover; }
.g-slide .ph .i { width: 88px; height: 88px; }
.g-count { position: sticky; right: 12px; bottom: 12px; margin-left: auto; align-self: flex-end; flex: none; padding: 4px 10px; border-radius: 999px; background: rgba(0, 0, 0, 0.6); color: #fff; font-size: 12px; font-weight: 700; transform: translateX(-12px); margin-bottom: 12px; }
.item-title { font-size: clamp(24px, 4.4vw, 34px); line-height: 1.2; font-weight: 800; letter-spacing: -0.02em; }
.item-desc { color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.facts { display: grid; gap: 14px; }
.fact { display: flex; gap: 12px; align-items: flex-start; }
.fact > .i { color: var(--primary); margin-top: 2px; }
.fact small { display: block; font-size: 12px; font-weight: 700; color: var(--text-3); }
.item-map { height: 200px; border-radius: var(--r-lg); position: relative; z-index: 0; }
.safe-box summary { display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; }
.safe-box summary::-webkit-details-marker { display: none; }
.safe-box summary::after { content: ''; margin-left: auto; width: 8px; height: 8px; border-right: 2px solid var(--text-3); border-bottom: 2px solid var(--text-3); transform: rotate(45deg); transition: transform var(--t-base) var(--ease); }
.safe-box[open] summary::after { transform: rotate(225deg); }
.check-list { display: grid; gap: 10px; margin-top: 12px; font-size: 13px; color: var(--text-2); }
.check-list li { display: flex; gap: 8px; }
.check-list .i { color: var(--ok-500); margin-top: 2px; }
.steps { counter-reset: step; display: grid; gap: 14px; margin-bottom: 14px; }
.steps li { position: relative; padding-left: 40px; display: grid; gap: 2px; }
.steps li::before { counter-increment: step; content: counter(step); position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; font: 800 13px var(--font-num); }
.steps span { color: var(--text-2); font-size: 13px; }
.viewer { position: relative; display: grid; place-items: center; background: #000; border-radius: var(--r-lg); overflow: hidden; }
.viewer img { max-height: 70dvh; width: auto; max-width: 100%; object-fit: contain; }
.viewer-nav { position: absolute; bottom: 10px; left: 0; right: 0; display: flex; justify-content: center; align-items: center; gap: 12px; color: #fff; }
.radio-row { padding: 10px 12px; border: 1.5px solid var(--divider); border-radius: var(--r-md); cursor: pointer; transition: border-color var(--t-fast); }
.radio-row:has(input:checked) { border-color: var(--primary); background: var(--primary-50); }
.radio-row input { accent-color: var(--primary); width: 18px; height: 18px; }

/* ---------- Source labelling (shared by map, station, item) ---------- */
.src-line { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r-md); background: var(--surface-soft); font-size: 13px; }
.src-line.inline { padding: 0; background: none; }
.src-line .src-ico { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; flex: none; background: var(--surface); color: var(--text-2); }
.src-line .src-text { min-width: 0; display: grid; gap: 1px; }
.src-line small { color: var(--text-2); font-size: 12px; line-height: 1.45; }
.src-line.src-auto .src-ico { background: var(--ok-50); color: var(--ok-500); }
.src-line.src-manual { background: var(--lost-50); }
.src-line.src-manual .src-ico { background: var(--lost-100); color: var(--lost-600); }
.src-line.src-contact .src-ico { background: var(--surface-sunk); }
.src-err { color: var(--error-600); font-weight: 700; }
.type-tag.manual { background: var(--lost-500); color: #fff; }
:root[data-theme='dark'] .type-tag.manual { color: #1c1510; }

/* ---------- Map ---------- */
body.full-bleed .main { padding-bottom: 0; }
.map-screen { position: relative; height: calc(100dvh - 58px - var(--safe-t)); min-height: 420px; }
.map-side { display: none; }
.map-stage { position: relative; height: 100%; }
.map-canvas { position: absolute; inset: 0; z-index: 0; }
.map-layers { position: absolute; z-index: 400; top: 10px; left: 10px; right: 64px; display: grid; gap: 6px; pointer-events: none; }
.map-layers .chip-row { pointer-events: auto; padding: 2px 2px 4px; }
.map-layers .chip { box-shadow: var(--sh-sm); background: color-mix(in srgb, var(--surface) 94%, transparent); }
.map-layers .chip.active { background: var(--ink); }
.src-filter { align-items: center; }
.src-filter-label { font-size: 11px; font-weight: 800; color: var(--text-2); padding: 3px 8px; border-radius: 999px; background: color-mix(in srgb, var(--surface) 90%, transparent); box-shadow: var(--sh-xs); flex: none; }
.map-tools { position: absolute; z-index: 400; top: 10px; right: 10px; display: grid; gap: 8px; }
.map-tools .icon-btn.busy { animation: pulse-ring 1s infinite; }
.map-card { position: absolute; z-index: 450; left: 10px; right: 10px; bottom: calc(var(--nav-h) + 22px + var(--safe-b)); display: grid; gap: 10px; padding: 14px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--divider); box-shadow: var(--sh-lg); max-width: 460px; }
.map-card.pop { animation: rise var(--t-base) var(--ease-spring) both; }
.mc-head { display: flex; gap: 8px; align-items: flex-start; }
.mc-head > .grow { flex: 1; min-width: 0; }
.mc-head > .icon-btn { flex: none; margin: -4px -4px 0 0; }
.mc-title { font-size: 16px; font-weight: 800; }
.map-legend { position: absolute; z-index: 400; left: 10px; bottom: calc(var(--nav-h) + 22px + var(--safe-b)); font-size: 12px; background: color-mix(in srgb, var(--surface) 94%, transparent); border: 1px solid var(--divider); border-radius: var(--r-md); box-shadow: var(--sh-sm); padding: 6px 10px; }
.map-screen:has(.map-card:not([hidden])) .map-legend { display: none; }
.map-legend summary { display: flex; align-items: center; gap: 6px; font-weight: 700; cursor: pointer; list-style: none; }
.map-legend summary::-webkit-details-marker { display: none; }
.map-legend ul { display: grid; gap: 6px; margin-top: 8px; }
.map-legend li { display: flex; align-items: center; gap: 8px; color: var(--text-2); }
.lg-pin { width: 22px; height: 22px; border-radius: 50% 50% 50% 3px; transform: rotate(-45deg); display: grid; place-items: center; color: #fff; background: var(--primary); flex: none; }
.lg-pin .i { transform: rotate(45deg); }
.lg-pin.is-empty { background: #6f6b66; } .lg-pin.is-unknown { background: #9a948d; } .lg-pin.is-lost { background: #282b30; }
.lg-warn { width: 14px; height: 14px; border-radius: 50%; background: var(--warn-500); margin: 0 4px; flex: none; }
.lg-area { width: 22px; height: 14px; border-radius: 3px; background: rgb(242 217 107 / 0.35); border: 2px solid #2f6b3a; flex: none; }
.map-pin .pin.pin-lost { --pin: #282b30; }
.map-row { display: flex; gap: 12px; align-items: center; width: 100%; padding: 10px 12px; border-radius: var(--r-md); text-align: left; transition: background-color var(--t-fast); }
.map-row:hover { background: var(--surface-soft); }
.map-row.sel { background: var(--primary-50); }
.map-row .grow { flex: 1; min-width: 0; display: grid; gap: 3px; }
.map-row .m-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--primary-50); color: var(--primary); flex: none; }
.map-row .m-thumb { width: 44px; height: 44px; border-radius: 12px; overflow: hidden; flex: none; background: var(--surface-soft); }
.map-row .m-thumb img, .map-row .m-thumb .ph { width: 100%; height: 100%; object-fit: cover; }
.map-row .m-thumb .ph .i { width: 22px; height: 22px; }
.map-group { font-size: 12px; font-weight: 800; color: var(--text-3); letter-spacing: 0.04em; padding: 12px 12px 4px; }
.map-sheet .map-side-head { display: none; }
.map-side-head { display: grid; gap: 2px; padding: 20px 20px 10px; }
.map-side-head h2 { font-size: 20px; font-weight: 800; }
.map-side-body { overflow-y: auto; padding: 0 8px 8px; flex: 1; }
.map-side-foot { padding: 12px 20px; border-top: 1px solid var(--divider); font-size: 12px; }

@media (min-width: 1024px) {
  .map-screen { height: 100dvh; display: grid; grid-template-columns: 380px minmax(0, 1fr); }
  .map-side { display: flex; flex-direction: column; min-height: 0; background: var(--surface); border-right: 1px solid var(--divider); }
  .map-list-btn { display: none; }
  .map-card { bottom: 20px; left: 20px; right: auto; width: 420px; }
  .map-legend { bottom: 20px; left: 20px; }
  .map-layers { left: 14px; top: 14px; }
  .map-tools { top: 14px; right: 14px; }
}

/* ---------- Campus directory / station ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 20px 0 16px; }
.page-head h1 { font-size: clamp(26px, 5vw, 36px); font-weight: 800; letter-spacing: -0.02em; }
.page-head p { max-width: 56ch; margin-top: 4px; }
.campus-stats { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 640px) { .campus-stats { grid-template-columns: repeat(4, 1fr); } }
.src-row { display: grid; gap: 4px; padding-top: 10px; border-top: 1px solid var(--divider); }
.src-row:first-child { border-top: 0; padding-top: 0; }
.station-layout { display: grid; gap: 20px; padding-top: 16px; }
/* The side column holds contacts, map, update log and sync details; sticky would hide whatever is below the fold. */
@media (min-width: 900px) { .station-layout { grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr); gap: 32px; align-items: start; padding-top: 28px; } .station-layout .item-side { position: static; } }
.kv { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.kv > span { color: var(--text-2); }
.timeline { display: grid; gap: 14px; margin-top: 6px; position: relative; }
.timeline li { display: flex; gap: 12px; position: relative; }
.timeline li:not(:last-child)::after { content: ''; position: absolute; left: 4px; top: 14px; bottom: -16px; width: 2px; background: var(--divider); }
.timeline .tl-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--primary); margin-top: 5px; flex: none; z-index: 1; }
.timeline small { display: block; color: var(--text-2); font-size: 12px; }
.timeline b { font-size: 13px; }

/* ---------- Forms: add / admin station edit ---------- */
.pick-map { height: 240px; border-radius: var(--r-lg); border: 1.5px solid var(--divider); overflow: hidden; position: relative; z-index: 0; }
.add-form .tile-grid { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); }
.edit-layout { display: grid; gap: 20px; }
@media (min-width: 1000px) { .edit-layout { grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 28px; align-items: start; } .edit-side { position: sticky; top: 24px; } }
.item-edit { display: grid; gap: 10px; padding: 14px; border-radius: var(--r-md); background: var(--surface-soft); animation: pop var(--t-base) var(--ease-spring); }
.err-list { margin: 6px 0 0 18px; list-style: disc; }
code { font: 600 12px/1.4 ui-monospace, 'SF Mono', Menlo, monospace; padding: 1px 6px; border-radius: 5px; background: var(--surface-sunk); overflow-wrap: anywhere; }
.log { display: grid; }
.log li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--divider); font-size: 13px; }
.log li:first-child { border-top: 0; }
.log li small { margin-left: auto; }
.sync-history { border-top: 1px solid var(--divider); padding-top: 12px; }
.sync-history summary { display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; font-weight: 700; }
.sync-history summary::-webkit-details-marker { display: none; }
.sync-history summary small { margin-left: auto; font-weight: 400; font-size: 12px; }
.sync-history summary::after { content: ''; width: 8px; height: 8px; border-right: 2px solid var(--text-3); border-bottom: 2px solid var(--text-3); transform: rotate(45deg); transition: transform var(--t-base) var(--ease); }
.sync-history[open] summary::after { transform: rotate(225deg); }
.sync-history[open] summary { margin-bottom: 8px; }
.sync-history[open] summary small { display: none; }
.sync-history[open] summary::after { margin-left: auto; }
.sync-runs { max-height: 340px; overflow-y: auto; }
.sync-runs li { align-items: flex-start; }
.sync-runs .grow { min-width: 0; }
.row-stale { background: var(--warn-50); }
/* A flex wrapper inside the cell: making the <td> itself flex takes it out of the table row and breaks the row borders. */
.tbl .row-actions { display: flex; gap: 6px; align-items: center; justify-content: flex-end; white-space: nowrap; }

/* ---------- Chats / notifications ---------- */
.chat-row { align-items: flex-start; }
.chat-item { display: flex; align-items: center; gap: 4px; margin-top: 2px; font-size: 12px; color: var(--primary); font-weight: 700; min-width: 0; }
.notif.unread { background: var(--primary-50); }
.notif.unread .t::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-right: 8px; }
.chat-room { display: flex; flex-direction: column; width: 100%; max-width: 760px; margin: 0 auto; }
/* Below the desktop split the chat fills the screen under the top bar, so the composer sits at the bottom however tall the bar is. */
@media (max-width: 1099px) {
  .main:has(.chat-room) { display: flex; flex-direction: column; height: 100dvh; padding-bottom: 0; }
  .main:has(.chat-room) > #outlet, .main:has(.chat-room) .view, .chat-split:has(.chat-room) { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  .chat-room { flex: 1; min-height: 0; }
}
@media (min-width: 1024px) { .chat-room { height: 100dvh; border-left: 1px solid var(--divider); border-right: 1px solid var(--divider); } .main:has(.chat-room, .chat-split) { padding-bottom: 0; } }
/* Phones and narrow windows show one thing at a time: the list page, or the open chat. */
.chat-placeholder { display: none; }
@media (max-width: 1099px) { .chat-split:has(.chat-room) > .chat-list-pane { display: none; } }
/* Desktop: conversation list on the left, the open chat (or a prompt to pick one) on the right. */
@media (min-width: 1100px) {
  .chat-split { display: grid; grid-template-columns: minmax(300px, 360px) minmax(0, 1fr); height: 100dvh; }
  .chat-split > .chat-list-pane { display: block; min-height: 0; overflow-y: auto; border-right: 1px solid var(--divider); background: var(--surface); }
  .chat-list-pane .page { max-width: none; padding: 0 14px 24px; }
  .chat-list-pane .page-head { padding-top: 24px; }
  .chat-row { border-radius: var(--r-md); }
  .chat-row.active { background: var(--primary-50); }
  .chat-split .chat-room { height: 100dvh; max-width: none; margin: 0; border: 0; min-width: 0; }
  .chat-placeholder { display: grid; place-items: center; min-width: 0; }
  .chat-room .msg { max-width: min(80%, 560px); }
}
.chat-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--divider); }
.chat-head .grow { flex: 1; min-width: 0; display: grid; }
.chat-item-card { display: flex; align-items: center; gap: 12px; margin: 10px 16px 0; padding: 10px 12px; border-radius: var(--r-md); background: var(--surface-soft); transition: background-color var(--t-fast); }
.chat-item-card:hover { background: var(--surface-sunk); }
.chat-item-card .grow { flex: 1; min-width: 0; display: grid; }
.ci-thumb { width: 44px; height: 44px; border-radius: 10px; overflow: hidden; flex: none; }
.ci-thumb img, .ci-thumb .ph { width: 100%; height: 100%; object-fit: cover; }
.ci-thumb .ph .i { width: 22px; height: 22px; }
.chat-scroll { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; overscroll-behavior: contain; }
.chat-scroll > div[data-msgs] { display: grid; gap: 6px; }
.day-sep { text-align: center; margin: 10px 0 4px; }
.day-sep span { font-size: 11px; font-weight: 700; color: var(--text-3); background: var(--surface-soft); padding: 3px 10px; border-radius: 999px; }
.msg { display: grid; gap: 2px; max-width: 80%; animation: rise var(--t-base) var(--ease-spring) both; }
.msg.me { justify-self: end; justify-items: end; }
.msg.peer { justify-self: start; }
.msg .bubble { padding: 10px 14px; border-radius: 18px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.me .bubble { background: var(--primary); color: var(--on-primary); border-bottom-right-radius: 6px; }
.msg.peer .bubble { background: var(--surface-soft); border-bottom-left-radius: 6px; }
.msg small { font-size: 10px; color: var(--text-3); }
.msg.system { justify-self: center; max-width: 92%; display: flex; gap: 6px; align-items: flex-start; font-size: 12px; color: var(--text-2); background: var(--warn-50); padding: 8px 12px; border-radius: var(--r-md); text-align: left; }
.composer { display: flex; gap: 10px; align-items: flex-end; padding: 10px 14px calc(10px + var(--safe-b)); border-top: 1px solid var(--divider); background: var(--surface); }
.composer .textarea { min-height: 44px; max-height: 140px; border-radius: 22px; padding: 10px 16px; resize: none; }
.icon-send { width: 46px; height: 46px; padding: 0; border-radius: 50%; flex: none; }

/* ---------- Profile / points / settings ---------- */
.profile-card { position: relative; overflow: hidden; margin-top: 16px; padding: 0 18px 18px; display: grid; gap: 16px; }
.profile-bg { height: 76px; margin: 0 -18px; background: linear-gradient(120deg, var(--primary-500), var(--primary-700)); position: relative; overflow: hidden; }
.profile-bg::after { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 85% 20%, rgb(255 255 255 / 0.28), transparent 45%), radial-gradient(circle at 10% 110%, rgb(0 0 0 / 0.18), transparent 50%); }
.profile-main { display: flex; align-items: flex-end; gap: 14px; margin-top: -38px; position: relative; }
.profile-main .avatar { border: 4px solid var(--surface); box-shadow: var(--sh-sm); }
.profile-main .grow { min-width: 0; }
.profile-main h1 { font-size: 22px; font-weight: 800; line-height: 1.2; }
.profile-main p { font-size: 13px; }
.profile-main .btn { align-self: flex-start; margin-top: 44px; }
@media (min-width: 640px) { .profile-main .btn { margin-top: 0; align-self: flex-end; } }
a.badge-strip { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; color: inherit; }
.badge-mini { width: 34px; height: 34px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-soft); color: var(--text-3); filter: grayscale(1); opacity: 0.65; transition: transform var(--t-base) var(--ease-spring); }
.badge-mini.on { background: var(--reward-100); color: var(--reward-500); filter: none; opacity: 1; }
a.badge-strip:hover .badge-mini { transform: translateY(-2px); }
.status-stats > a { color: inherit; transition: transform var(--t-fast), background-color var(--t-fast); }
.status-stats > a:hover { background: var(--primary-50); transform: translateY(-2px); }
.swatch-btn { width: 44px; height: 44px; border-radius: 50%; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--divider-strong); transition: transform var(--t-base) var(--ease-spring), box-shadow var(--t-fast); }
.swatch-btn:hover { transform: scale(1.1); }
.swatch-btn.active { box-shadow: 0 0 0 3px var(--primary); transform: scale(1.08); }
.points-hero { display: flex; align-items: center; gap: 18px; background: linear-gradient(135deg, var(--primary-50), var(--reward-50)); border-color: var(--primary-100); }
.ph-art { width: 68px; height: 68px; border-radius: 22px; display: grid; place-items: center; background: linear-gradient(145deg, var(--reward-400), var(--primary-500)); color: #fff; box-shadow: var(--sh-primary); animation: float-y 3.4s ease-in-out infinite; }
.ph-num { font-size: 48px; font-weight: 800; line-height: 1; color: var(--primary); }
.prose { padding-bottom: 24px; }
.profile-side { display: grid; gap: 14px; }

/* Desktop: profile, points and settings use two columns instead of a phone-width strip. */
@media (min-width: 1100px) {
  .page.profile-page, .page.points-page, .page.settings-page { max-width: 1080px; }
  .profile-layout { display: grid; grid-template-columns: minmax(300px, 360px) minmax(0, 1fr); gap: 32px; align-items: start; padding-top: 24px; }
  .profile-side { position: sticky; top: 24px; }
  .profile-side .profile-card { margin-top: 0; }
  .profile-side .profile-main { flex-direction: column; align-items: flex-start; gap: 10px; }
  .profile-side .profile-main .btn { margin-top: 0; align-self: stretch; justify-content: center; }
  .profile-body > .section:first-child { margin-top: 0; }
  .split-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); gap: 32px; align-items: start; }
  .split-side > :first-child { margin-top: 0 !important; }
}
.prose h1 { font-size: clamp(26px, 5vw, 34px); font-weight: 800; letter-spacing: -0.02em; margin: 18px 0 8px; }
.prose h2 { font-size: 18px; font-weight: 800; margin: 26px 0 8px; }
.prose p, .prose li { color: var(--text-2); line-height: 1.75; }
.prose ul { padding-left: 20px; display: grid; gap: 6px; list-style: disc; }
.prose b { color: var(--text); }
.about-brand { display: grid; gap: 6px; justify-items: start; padding-top: 22px; }

/* ---------- QR tags ---------- */
.qr-card { display: flex; gap: 16px; padding: 14px; align-items: flex-start; }
.qr-card .grow { min-width: 0; display: grid; gap: 2px; }
.qr-thumb { width: 96px; height: 96px; flex: none; border-radius: var(--r-md); overflow: hidden; background: #fff; border: 1px solid var(--divider); display: grid; place-items: center; transition: transform var(--t-base) var(--ease-spring); }
.qr-thumb:hover { transform: scale(1.06) rotate(-1.5deg); }
.qr-thumb svg, .qr-big svg { width: 100%; height: 100%; display: block; }
.qr-big { width: min(100%, 260px); aspect-ratio: 1; border-radius: var(--r-lg); overflow: hidden; background: #fff; border: 1px solid var(--divider); display: grid; place-items: center; box-shadow: var(--sh-md); animation: pop var(--t-slow) var(--ease-spring) both; }
.qr-preview { display: flex; align-items: center; gap: 18px; }
.qr-preview .qr-big { width: 132px; flex: none; animation: none; box-shadow: var(--sh-sm); }
.qr-big.is-empty { background: var(--surface-sunk); border: 1.5px dashed var(--divider-strong); box-shadow: none; color: var(--text-3); align-content: center; gap: 6px; text-align: center; font-size: 12px; padding: 8px; }
.qr-big.is-empty svg { width: 32px; height: 32px; margin: 0 auto; }
.qr-preview .grow { flex: 1; min-width: 0; }
.scan-card { overflow: hidden; }
.scan-view { position: relative; aspect-ratio: 4 / 3; background: #15171a; display: grid; place-items: center; overflow: hidden; }
.scan-view video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scan-view video[hidden], .scan-idle[hidden] { display: none; }
.scan-idle { position: relative; display: grid; justify-items: center; gap: 10px; color: rgb(255 255 255 / 0.78); text-align: center; padding: 0 24px; font-size: 14px; }
.scan-frame { position: absolute; inset: 14%; pointer-events: none; }
.scan-frame i { position: absolute; width: 28px; height: 28px; border: 4px solid #fff; border-radius: 6px; }
.scan-frame i:nth-child(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; }
.scan-frame i:nth-child(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; }
.scan-frame i:nth-child(3) { bottom: 0; left: 0; border-right: 0; border-top: 0; }
.scan-frame i:nth-child(4) { bottom: 0; right: 0; border-left: 0; border-top: 0; }
.scan-line { position: absolute; left: 6%; right: 6%; top: 0; height: 2px; border-radius: 2px; background: var(--primary-400); box-shadow: 0 0 14px var(--primary-400); animation: scan-sweep 2.2s ease-in-out infinite alternate; }
@keyframes scan-sweep { from { top: 4%; } to { top: 96%; } }
.tag-card { display: grid; gap: 12px; justify-items: center; text-align: center; padding: 28px 20px; margin-top: 16px; }
.tag-ico { width: 72px; height: 72px; border-radius: 24px; display: grid; place-items: center; background: var(--primary-50); color: var(--primary); animation: pop var(--t-slow) var(--ease-spring) both; }
.contact-box { display: grid; gap: 4px; width: min(100%, 420px); padding: 16px; border-radius: var(--r-md); background: var(--surface-soft); border: 1px dashed var(--divider-strong); }
.contact-box b { font-size: 20px; word-break: break-all; user-select: all; }
.tag-card .notice { text-align: left; width: min(100%, 420px); }
.gallery.no-photo { aspect-ratio: 16 / 7; max-height: 220px; }
@media (min-width: 900px) { .gallery.no-photo { aspect-ratio: 16 / 7; } }
