/* Friends and rich profile («Creuza a colori»): web/friends.js (Amici segment, invites, place strip, home activity)
   and the profile header / privacy step of web/social.js. Prefix cm- (community). Tokens: app.css. */

/* Cover colours (profile band, suggestion cards, swatches) */
.cm-cover-rosso { --cover: var(--color-block-red); --cover-ink: var(--color-block-red-text); }
.cm-cover-giallo { --cover: var(--color-block-yellow); --cover-ink: var(--color-block-yellow-text); }
.cm-cover-blu { --cover: var(--color-block-blue); --cover-ink: var(--color-block-blue-text); }
.cm-cover-verde { --cover: color-mix(in srgb, var(--color-block-blue) 30%, var(--color-ok)); --cover-ink: var(--color-block-blue-text); }
.cm-cover-inchiostro { --cover: var(--color-block-ink); --cover-ink: var(--color-block-ink-text); }
.cm-cover-crema { --cover: color-mix(in srgb, var(--color-block-yellow) 22%, var(--color-block-ink-text)); --cover-ink: var(--color-block-yellow-text); }
.cm-i { width: 20px; height: 20px; flex: none; }

/* ---------- Amici header: direct messages ---------- */
.amici-dm { position: relative; display: grid; place-items: center; flex: none; width: 48px; height: 48px; border-radius: 50%; color: var(--color-ink); background: var(--color-surface); border: var(--border-width) solid var(--color-outline); box-shadow: var(--elevation-2); text-decoration: none; }
.amici-dm:active { box-shadow: var(--press-shadow); transform: translate(2px, 2px); }
.amici-dm .tg-i { width: 22px; height: 22px; }
.amici-dm-count { position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; display: grid; place-items: center; background: var(--color-accent); color: var(--color-accent-ink); font-size: var(--type-caption-size); font-weight: 850; border: 2px solid var(--color-bg); }
.amici-page.has-inbox .social-top { right: 58px; top: 12px; }

/* ---------- First privacy step and «Privacy del profilo» ---------- */
.cm-setup { padding-top: 4px; }
.cm-setup-head { margin: var(--space-2) 0 var(--space-6); padding: var(--space-6) var(--space-5) var(--space-5); border-radius: var(--radius-xl); background: var(--color-block-yellow); color: var(--color-block-yellow-text); border: var(--border-width) solid var(--color-outline); box-shadow: var(--elevation-3); }
.cm-setup-head .app-kicker { color: var(--color-block-yellow-text); margin: 0 0 var(--space-2); }
.cm-setup-title { font: var(--type-display-l); font-stretch: var(--type-display-l-stretch); text-transform: uppercase; line-height: .95; margin: 0 0 var(--space-3); }
.cm-setup-head p:last-child { margin: 0; font-size: var(--type-body-size); font-weight: 600; }
.cm-privacy-form { display: grid; gap: 18px; }
.cm-field { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: 10px; }
.cm-legend { font: var(--type-display-m); font-size: var(--type-display-s-size); font-stretch: var(--type-display-m-stretch); text-transform: uppercase; padding: 0; margin-bottom: var(--space-3); }
.cm-legend small { font: 600 var(--type-caption-size) var(--font); text-transform: none; }
.cm-help { color: var(--muted); font-size: var(--type-body-s-size); font-weight: 600; margin: -4px 0 0; }
.cm-choices { display: grid; gap: 10px; }
@media (min-width: 520px) { .cm-choices { grid-template-columns: 1fr 1fr; } }
.cm-choice { position: relative; display: block; cursor: pointer; }
.cm-choice input, .cm-chip input, .cm-swatch input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.cm-choice-card { display: flex; gap: var(--space-4); align-items: flex-start; padding: var(--space-4); border-radius: var(--radius-md); background: var(--color-surface); border: var(--border-width) solid var(--color-outline); box-shadow: var(--elevation-2); transition: background var(--motion-base) var(--motion-ease), box-shadow var(--motion-fast) var(--motion-ease), transform var(--motion-fast) var(--motion-ease); }
.cm-choice-icon { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--surface-2); border: 2px solid var(--color-outline); }
.cm-choice-copy { display: grid; gap: 2px; min-width: 0; }
.cm-choice-copy strong { font-size: var(--type-body-l-size); font-weight: 850; }
.cm-choice-copy small { color: var(--ink-2); font-size: var(--type-body-s-size); font-weight: 600; line-height: 1.35; }
.cm-choice input:checked + .cm-choice-card { background: var(--color-blue-soft); box-shadow: var(--elevation-pressed); transform: translate(1px, 1px); }
.cm-choice input:checked + .cm-choice-card .cm-choice-icon { background: var(--color-block-blue); color: var(--color-block-blue-text); }
.cm-choice input:focus-visible + .cm-choice-card, .cm-chip input:focus-visible + span, .cm-swatch:focus-within { outline: 3px solid color-mix(in srgb, var(--color-accent) 70%, transparent); outline-offset: 3px; }
.cm-aud { display: grid; gap: 0; border: var(--border-width) solid var(--color-outline); border-radius: var(--radius-lg); background: var(--color-surface); overflow: hidden; }
.cm-aud-row { display: grid; gap: var(--space-3); padding: var(--space-4); }
.cm-aud-row + .cm-aud-row { border-top: var(--border-hairline) solid var(--color-line); }
.cm-aud-name { display: grid; gap: 1px; }
.cm-aud-name strong { font-weight: 850; font-size: var(--type-body-size); }
.cm-aud-name small { color: var(--muted); font-size: var(--type-caption-size); font-weight: 600; }
.cm-aud-chips { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-1); max-width: 480px; padding: var(--space-1); border-radius: var(--radius-pill); background: var(--color-surface-2); }
.cm-chip { position: relative; display: block; cursor: pointer; min-width: 0; }
.cm-chip span { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 10px; border-radius: var(--r-pill); background: transparent; border: var(--border-width) solid transparent; color: var(--color-ink-2); font: var(--type-label); font-size: var(--type-body-s-size); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cm-chip span .social-i { width: 16px; height: 16px; }
.cm-chip input:checked + span { background: var(--color-surface); color: var(--color-ink); border-color: var(--color-outline); box-shadow: var(--elevation-1); }
.cm-covers { display: flex; flex-wrap: wrap; gap: 12px; }
.cm-swatch { position: relative; display: block; width: 48px; height: 48px; border-radius: 50%; background: var(--cover); border: var(--border-width) solid var(--color-outline); box-shadow: var(--elevation-2); cursor: pointer; }
.cm-swatch:has(input:checked) { box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px var(--ink); }
.cm-swatch:has(input:checked)::after { content: ""; position: absolute; inset: 0; margin: auto; width: 14px; height: 8px; border: solid var(--cover-ink); border-width: 0 0 3px 3px; transform: translateY(-2px) rotate(-45deg); }
.cm-privacy { scroll-margin-top: calc(var(--header-h) + 16px); }

/* ---------- Profile (#u/<handle>): cover band, avatar with ink outline, counts, sections ---------- */
.cm-profile { padding-top: 0; }
.cm-band { height: 92px; margin: 0 calc(-1 * var(--gutter)); background: var(--cover, var(--color-block-blue)); border-bottom: 2px solid var(--color-outline); }
.cm-profile-top { align-items: flex-end; gap: 12px; }
.cm-profile .social-avatar.is-xl { width: 92px; height: 92px; margin-top: -46px; font-size: 32px; border: 3px solid var(--color-outline); box-shadow: 0 0 0 4px var(--bg); background-color: var(--avatar); }
.cm-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); padding-bottom: 2px; }
.cm-stats .social-stat { min-width: 0; padding: 6px 0; text-decoration: none; color: inherit; }
.cm-stats .social-stat b { font-size: var(--type-title-size); font-weight: 900; font-stretch: 72%; }
.cm-stats .social-stat span { font-size: var(--type-caption-size); overflow: hidden; text-overflow: ellipsis; }
.cm-pills { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; }
.social-pill.is-friend { background: var(--ok-soft); color: var(--ok); gap: 4px; align-items: center; }
.social-pill .social-i { width: 13px; height: 13px; }
.cm-profile .social-profile-actions { flex-wrap: wrap; }
.cm-profile .social-profile-actions .button { flex: 1 1 120px; gap: 6px; }
.cm-profile .social-profile-actions .button .social-i { width: 17px; height: 17px; }
.cm-is-friend { background: var(--ok-soft) !important; color: var(--ok) !important; }
.cm-sec { margin: 18px 0 0; min-width: 0; }
.cm-sec-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.cm-sec-title { font: 900 var(--type-display-s-size)/1 var(--display); font-stretch: 70%; text-transform: uppercase; margin: 0; }
.cm-who { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: var(--r-pill); background: var(--surface-2); color: var(--ink-2); font-size: var(--type-caption-size); font-weight: 800; }
.cm-who .social-i { width: 13px; height: 13px; }
.cm-sec-more { margin-left: auto; font-size: var(--type-label-size); }
.cm-badges { display: flex; flex-wrap: wrap; gap: 8px; }
.cm-badge { display: inline-flex; align-items: baseline; gap: 6px; padding: 7px 12px; border-radius: var(--r-pill); background: var(--gold-soft); border: 2px solid var(--color-outline); font-size: var(--type-body-s-size); font-weight: 750; }
.cm-badge b { font: 900 var(--type-title-size)/1 var(--display); font-stretch: 72%; }
:where([data-theme="dark"]) .cm-badge { color: var(--ink); }
.cm-pins { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.cm-pin { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 10px; border-radius: var(--r-md); background: var(--surface); border: var(--card-border); box-shadow: 3px 3px 0 var(--color-shadow); color: var(--ink); text-decoration: none; text-align: left; font: inherit; cursor: pointer; }
.cm-pin:active { box-shadow: var(--press-shadow); transform: translate(2px, 2px); }
.cm-pin-mark { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 12px; background: var(--accent); color: var(--color-accent-ink); }
.cm-pin-mark .social-i { width: 19px; height: 19px; }
.cm-pin:nth-child(3n+2) .cm-pin-mark { background: var(--color-block-blue); }
.cm-pin:nth-child(3n) .cm-pin-mark { background: var(--gold); color: var(--color-block-yellow-text); }
.cm-pin.is-add { grid-column: 1 / -1; border-style: dashed; box-shadow: none; background: transparent; }
.cm-pin.is-add .cm-pin-mark { background: var(--surface-2); color: var(--ink); }
.cm-pin-copy { display: grid; min-width: 0; line-height: 1.2; }
.cm-pin-copy strong { font-size: var(--type-label-size); font-weight: 800; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cm-pin-copy small { color: var(--muted); font-size: var(--type-caption-size); font-weight: 700; }
.cm-tastes { display: flex; flex-wrap: wrap; gap: 8px; }
.cm-taste { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px; border-radius: var(--r-pill); background: var(--surface-2); border: 1.5px solid var(--line-strong); font-size: var(--type-body-s-size); font-weight: 750; color: var(--ink); text-decoration: none; }
.cm-taste.is-add { border-style: dashed; }
.cm-taste .social-i { width: 15px; height: 15px; }
.cm-profile + .cm-sec { margin-top: 20px; }
.cm-sec + .social-profile-tabs, .cm-sec + .social-empty { margin-top: 18px; }
.cm-pin-edit { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; }
.cm-pin-edit li { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 12px; border-radius: var(--r-sm); background: var(--surface-2); font-weight: 750; }
.cm-pin-edit li > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cm-pin-edit .social-i { width: 18px; height: 18px; }
.cm-dlg-h { font: 900 var(--type-body-l-size)/1 var(--display); font-stretch: 70%; text-transform: uppercase; margin: 14px 0 8px; }
.cm-pin-picks, .cm-pick-places { display: flex; flex-wrap: wrap; gap: 8px; }
.cm-pin-picks .chip .social-i { width: 15px; height: 15px; }
.cm-pick-places .cm-chip span { min-height: 36px; }
.cm-steps { margin: 0 0 14px; padding-left: 20px; display: grid; gap: 6px; font-weight: 600; }
.cm-group-emoji { font-size: var(--type-display-s-size); }

/* ---------- Amici › Amici ---------- */
.cm-friends-page { display: grid; gap: 18px; min-width: 0; }
.cm-search { margin: 0; }
.cm-invite { padding: 16px; border-radius: var(--r-lg); background: var(--gold); color: var(--color-block-yellow-text); border: var(--card-border); box-shadow: var(--card-shadow); min-width: 0; }
.cm-invite-head { display: flex; gap: 12px; align-items: flex-start; }
.cm-invite-mark { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 50%; background: #ffffff; border: 2px solid #1d1f24; }
.cm-invite h2 { font: 900 var(--type-display-m-size)/1 var(--display); font-stretch: 68%; text-transform: uppercase; margin: 2px 0 4px; }
.cm-invite p { margin: 0; font-size: var(--type-label-size); font-weight: 600; line-height: 1.4; }
.cm-invite-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.cm-invite-actions .button { flex: 1 1 130px; gap: 6px; }
.cm-invite-actions .social-i { width: 17px; height: 17px; }
.cm-invite .button.secondary { background: #ffffff; color: #1d1f24; }
.cm-invite-body { display: grid; gap: 10px; justify-items: center; margin-top: 14px; min-width: 0; }
.cm-qr { width: min(232px, 72vw); padding: 10px; border-radius: var(--r-md); background: #ffffff; border: 2px solid #1d1f24; box-shadow: 4px 4px 0 #1d1f24; }
.cm-qr svg { width: 100%; height: auto; }
.cm-invite-url { width: 100%; min-width: 0; height: 40px; padding: 0 12px; border-radius: var(--r-sm); border: 2px solid #1d1f24; background: #ffffff; color: #1d1f24; font: 600 var(--type-body-s-size) var(--font); text-overflow: ellipsis; }
.cm-invite-body .cm-invite-actions { margin-top: 0; width: 100%; }
.cm-fine { font-size: var(--type-caption-size) !important; text-align: center; opacity: .85; }
.cm-fine .text-button { color: inherit; font-size: var(--type-caption-size); text-decoration: underline; padding: 0; min-height: 0; }
dialog .cm-invite-body { color: var(--ink); }
dialog .cm-invite-url { border-color: var(--line-strong); }
dialog .cm-qr { border-color: var(--color-outline); }
.cm-block { min-width: 0; }
.cm-block-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.cm-block-head h2 { font: 900 var(--type-display-s-size)/1 var(--display); font-stretch: 70%; text-transform: uppercase; margin: 0; }
.cm-count { min-width: 24px; height: 24px; padding: 0 7px; border-radius: 12px; display: inline-grid; place-items: center; background: var(--ink); color: var(--bg); font-size: var(--type-caption-size); font-weight: 850; }
.cm-friends-list, .cm-requests { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.cm-friend { display: flex; align-items: center; gap: 6px; min-width: 0; }
.cm-friend-main { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; padding: 8px; border-radius: var(--r-sm); color: inherit; text-decoration: none; }
.cm-friend-main:hover { background: var(--surface-2); }
.cm-friend-main .social-avatar { width: 46px; height: 46px; font-size: var(--type-body-l-size); border: 2px solid var(--color-outline); }
.cm-friend-copy { display: grid; min-width: 0; }
.cm-friend-copy strong { font-weight: 800; font-size: var(--type-body-size); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cm-friend-copy small { color: var(--muted); font-size: var(--type-body-s-size); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cm-friend-dm { flex: none; width: 42px; height: 42px; color: var(--ink); }
.cm-req-actions { display: flex; gap: 6px; flex: none; }
.cm-req-actions .button { min-height: 36px; padding: 0 12px; }
.cm-req-actions .social-i { width: 16px; height: 16px; }
.cm-more { margin: 8px auto 0; display: flex; }
.cm-empty { display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: var(--r-md); background: var(--surface-2); }
.cm-empty p { margin: 0; font-size: var(--type-label-size); }
.cm-empty-line { padding: 8px; }
.cm-sugg-rail { display: grid; grid-auto-flow: column; grid-auto-columns: 148px; gap: 12px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; margin: 0 calc(-1 * var(--gutter)); padding: 4px var(--gutter) 10px; scrollbar-width: none; }
.cm-sugg-rail::-webkit-scrollbar { display: none; }
.cm-sugg { scroll-snap-align: start; display: grid; gap: 10px; align-content: space-between; padding: 0 10px 12px; border-radius: var(--r-md); background: var(--surface); border: var(--card-border); box-shadow: 3px 3px 0 var(--color-shadow); overflow: hidden; min-width: 0; }
.cm-sugg-who { display: grid; justify-items: center; gap: 2px; text-align: center; color: inherit; text-decoration: none; min-width: 0; }
.cm-sugg-band { display: block; justify-self: stretch; height: 34px; margin: 0 -10px; background: var(--cover); border-bottom: 2px solid var(--color-outline); }
.cm-sugg .social-avatar.is-lg { width: 58px; height: 58px; font-size: var(--type-display-s-size); margin: -26px 0 4px; border: 2px solid var(--color-outline); box-shadow: 0 0 0 3px var(--surface); }
.cm-sugg strong { font-size: var(--type-label-size); font-weight: 850; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cm-sugg small { color: var(--muted); font-size: var(--type-caption-size); font-weight: 650; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.5em; }
.cm-sugg .button { width: 100%; min-height: 36px; gap: 4px; }
.cm-sugg .button .social-i { width: 15px; height: 15px; }

/* ---------- Invite landing (#amico/<token>) ---------- */
.cm-landing-card { display: grid; justify-items: center; text-align: center; padding: 0 16px 18px; border-radius: var(--r-lg); background: var(--surface); border: var(--card-border); box-shadow: var(--card-shadow); overflow: hidden; }
.cm-landing-card .cm-band { justify-self: stretch; margin: 0 -16px; height: 84px; }
.cm-landing-card .social-avatar.is-xl { margin-top: -44px; border: 3px solid var(--color-outline); box-shadow: 0 0 0 4px var(--surface); }
.cm-landing-name { font: 900 30px/1 var(--display); font-stretch: 68%; text-transform: uppercase; margin: 12px 0 2px; overflow-wrap: anywhere; }
.cm-landing-lead { margin: 14px 0 0; font-size: var(--type-body-l-size); font-weight: 650; }
.cm-landing-actions { display: grid; gap: 8px; width: 100%; margin-top: 16px; }
.cm-landing-actions .button { gap: 8px; }
.cm-landing-what { margin-top: 18px; padding: 16px; border-radius: var(--r-lg); background: var(--sea-soft); border: var(--card-border); }
.cm-landing-what h2 { font: 900 var(--type-display-s-size)/1 var(--display); font-stretch: 70%; text-transform: uppercase; margin: 0 0 10px; }
.cm-landing-what ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.cm-landing-what li { display: flex; gap: 10px; align-items: flex-start; font-size: var(--type-label-size); font-weight: 600; }
.cm-landing-what .social-i { width: 20px; height: 20px; color: var(--color-blue); margin-top: 1px; }
:where([data-theme="dark"]) .cm-landing-what .social-i { color: var(--sea); }
.cm-landing > .cm-invite-body { margin-top: 18px; }

/* ---------- Place sheet: friends who have been there, «Invia a un amico» ---------- */
.cm-place { display: grid; gap: 12px; margin: 14px 0 8px; padding: 14px; border-radius: var(--r-lg); background: var(--sea-soft); border: var(--card-border); }
.cm-place-friends { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cm-stack { display: flex; flex: none; }
.cm-stack a { display: block; margin-left: -10px; border-radius: 50%; }
.cm-stack a:first-child { margin-left: 0; }
.cm-stack .social-avatar { width: 36px; height: 36px; border: 2px solid var(--color-outline); box-shadow: 0 0 0 2px var(--sea-soft); }
.cm-place-copy { display: grid; min-width: 0; line-height: 1.25; }
.cm-place-copy strong { font-weight: 850; font-size: var(--type-body-size); }
.cm-place-copy small { color: var(--ink-2); font-size: var(--type-body-s-size); font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cm-place-send .button, .cm-send { gap: 6px; }
.cm-send .social-i { width: 16px; height: 16px; }
:where([data-theme="dark"]) .cm-place { color: var(--ink); }

/* ---------- Oggi: «Gli amici» ---------- */
.cm-activity { list-style: none; margin: 0; padding: 4px; display: grid; gap: 2px; border-radius: var(--r-lg); background: var(--surface); border: var(--card-border); box-shadow: var(--card-shadow); }
.cm-act { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 10px; border-radius: var(--r-md); color: inherit; text-decoration: none; }
.cm-act:hover { background: var(--surface-2); }
.cm-act .social-avatar { width: 40px; height: 40px; border: 2px solid var(--color-outline); }
.cm-act-copy { display: grid; gap: 2px; flex: 1; min-width: 0; font-size: var(--type-label-size); line-height: 1.3; }
.cm-act-copy > span { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.cm-act-copy strong { font-weight: 850; }
.cm-act-copy small { color: var(--muted); font-size: var(--type-caption-size); font-weight: 650; }
.cm-act-rating { color: var(--color-warn); margin-right: 6px; letter-spacing: 1px; }
.cm-act-thumb { flex: none; width: 48px; height: 48px; border-radius: 10px; object-fit: cover; border: 2px solid var(--color-outline); }
.cm-act-kind { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 12px; background: var(--surface-2); color: var(--accent); }
.cm-act-kind.is-review { color: var(--color-warn); }
.cm-act-kind.is-joined { color: var(--color-blue); }
.cm-act-kind .social-i { width: 19px; height: 19px; }
:where([data-theme="dark"]) .cm-act-rating, :where([data-theme="dark"]) .cm-act-kind.is-review { color: var(--gold); } :where([data-theme="dark"]) .cm-act-kind.is-joined { color: var(--sea); }
