/* Friend sheet: FriendDetailView.swift. A grey sheet with white cards, as NativeSheetBackground and nativeCard. */
dialog:has(.fs) { width: min(480px, calc(100% - 32px)); background: rgb(242 242 247 / .94); }
/* The body scrolls, not the dialog: a scrollbar on the dialog cuts its rounded corners.
   Fixed height: a short day must not make the sheet jump. */
dialog[open]:has(.fs) { display: flex; flex-direction: column; height: min(860px, calc(100dvh - 40px)); overflow: hidden; }
dialog:has(.fs) .modal-header {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 36px;
  align-items: center;
  gap: 8px;
  padding: 12px 14px 8px;
}
dialog:has(.fs) #modal-title { grid-column: 2; margin: 0; overflow: hidden; font-size: 1.0625rem; font-weight: 600; line-height: 1.3; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
dialog:has(.fs) .modal-header .icon-button { grid-column: 3; margin: 0; }
dialog:has(.fs) .modal-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; padding: 4px 16px 20px; }

.fs { display: grid; gap: 12px; min-width: 0; }
.fs h3, .fs p, .fs ul { margin: 0; }
.fs [data-tint="fast"] { --tint: #16b05a; --tint-ink: #0d8744; }
.fs [data-tint="food"] { --tint: #ff9500; --tint-ink: #b85c00; }
.fs [data-tint="steps"] { --tint: #34c759; --tint-ink: #16803c; }
.fs [data-tint="activity"] { --tint: #00c7be; --tint-ink: #00807a; }
.fs [data-tint="water"] { --tint: #32ade6; --tint-ink: #0a7fb5; }
.fs [data-tint="weight"] { --tint: #5856d6; --tint-ink: #4845c4; }
.fs [data-tint="support"] { --tint: #ff2d55; --tint-ink: #d3123e; }

/* Header */
.fs-hero { display: grid; justify-items: center; gap: 10px; padding: 2px 0 4px; }
.fs-face { position: relative; display: grid; place-items: center; width: 80px; height: 80px; border-radius: 50%; background: color-mix(in srgb, var(--avatar, var(--accent)) 22%, white); color: var(--ink); font-size: 2.5rem; font-weight: 600; line-height: 1; }
.fs-face-badge { position: absolute; inset-inline-end:-2px; bottom: -2px; display: grid; place-items: center; width: 26px; height: 26px; border: 3px solid #f2f2f7; border-radius: 50%; background: var(--accent); color: #fff; }
.fs-face-badge .icon { width: 12px; height: 12px; color: #fff; }
.fs-hero-line { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; }
.fs-hero-line small { color: var(--muted); font-size: .8125rem; }
.fs-streak { display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px; border-radius: 999px; background: rgb(142 142 147 / .14); color: var(--muted); font-size: .8125rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.fs-streak .icon { width: 13px; height: 13px; }
.fs-streak[data-active="true"] { background: #ff950024; color: #b85c00; }

/* Week */
.fs-week { display: flex; align-items: center; padding: 12px 6px; border-radius: var(--radius); background: var(--surface); }
.fs-days { flex: 1; min-width: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.fs-day-button { display: grid; justify-items: center; gap: 5px; padding: 0; border: 0; border-radius: 12px; background: none; color: var(--muted); cursor: pointer; }
.fs-weekday { font-size: .6875rem; font-weight: 500; }
.fs-day-button[aria-pressed="true"] .fs-weekday { color: var(--accent-ink); font-weight: 700; }
.fs-day-dot { width: 4px; height: 4px; border-radius: 50%; }
.fs-day-button[aria-pressed="true"] .fs-day-dot { background: var(--accent); }
.fs-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; transition: transform .25s cubic-bezier(.2, 1.4, .4, 1); }
.fs-day-button[aria-pressed="true"] .fs-mark { transform: scale(1.08); }
.fs-mark[data-state="met"] { background: linear-gradient(#34d277, #16b05a); }
.fs-mark[data-state="met"] .icon { width: 14px; height: 14px; color: #fff; }
.fs-mark[data-state="none"] { border: 1.5px dashed #c7c7cc; }
.fs-mark svg { display: block; width: 100%; height: 100%; fill: none; stroke: rgb(120 120 128 / .2); stroke-width: 3.5; }
.fs-mark .fs-ring-fill { stroke: rgb(22 176 90 / .85); stroke-linecap: round; }
.fs-week-page { flex-shrink: 0; display: grid; place-items: center; width: 24px; height: 48px; padding: 0; border: 0; border-radius: 10px; background: none; color: #8e8e93; cursor: pointer; }
.fs-week-page .icon { width: 13px; height: 13px; }

/* Cards */
.fs-card { display: grid; gap: 12px; min-width: 0; padding: 16px; border-radius: var(--radius); background: var(--surface); }
.fs-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.fs-card-title { display: inline-flex; align-items: center; gap: 7px; min-width: 0; }
.fs-card-title .icon { flex-shrink: 0; width: 17px; height: 17px; color: var(--tint-ink); }
.fs-card h3 { color: var(--ink); font-size: 1.0625rem; font-weight: 600; line-height: 1.3; }
.fs-trailing { min-width: 0; overflow: hidden; color: var(--muted); font-size: .9375rem; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
.fs-value { display: flex; align-items: baseline; gap: 6px; }
.fs-value b { color: var(--ink); font-size: 1.625rem; font-weight: 700; letter-spacing: -.01em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.fs-value > span { color: var(--muted); font-size: .9375rem; }
.fs-goal { display: inline-flex; align-items: center; gap: 3px; margin-inline-start: auto; color: var(--accent-ink); font-size: .8125rem; font-weight: 600; }
.fs-goal .icon { width: 12px; height: 12px; }
.fs-bar { display: block; height: 8px; overflow: hidden; border-radius: 4px; background: var(--track); }
.fs-bar > span { display: block; height: 100%; border-radius: inherit; background: var(--tint, var(--accent)); }
[data-tint="fast"] .fs-bar > span { background: linear-gradient(90deg, #34d277, #16b05a); }
.fs-note, .fs-empty { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: .875rem; line-height: 1.35; }
.fs-empty { font-size: .9375rem; }
.fs-live { flex-shrink: 0; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: fs-pulse 2s ease-in-out infinite; }
@keyframes fs-pulse { 50% { opacity: .35; } }

.fs-macros { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 2px; }
.fs-macro { display: grid; gap: 6px; min-width: 0; }
.fs-macro > span { color: var(--muted); font-size: .8125rem; font-weight: 500; }
.fs-macro .fs-bar { height: 5px; }
.fs-macro small { color: var(--muted); font-size: .8125rem; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fs-macro b { color: var(--ink); font-weight: 600; }
.fs-macro b.fs-over { color: #d3123e; }
.fs-macro[data-macro="protein"] { --tint: #ff5a5f; }
.fs-macro[data-macro="fat"] { --tint: #f5a623; }
.fs-macro[data-macro="carbs"] { --tint: #3b82f6; }

.fs-list { display: grid; padding: 0; list-style: none; }
.fs-list li { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 7px 0; }
.fs-meal-icon { flex-shrink: 0; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: #34c75924; }
.fs-meal-icon .icon { width: 15px; height: 15px; color: #16803c; }
.fs-row-text { flex: 1; min-width: 0; display: grid; gap: 1px; }
.fs-row-text b { overflow-wrap: anywhere; color: var(--ink); font-size: 1rem; font-weight: 500; line-height: 1.3; }
.fs-row-text small { color: var(--muted); font-size: .8125rem; }
.fs-amount { flex-shrink: 0; color: var(--ink); font-size: .9375rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.fs-time { color: var(--muted); font-size: .8125rem; font-weight: 400; }

.fs-inline { display: flex; align-items: center; gap: 10px; }
.fs-inline .fs-bar { flex: 1; }
.fs-inline b { min-width: 40px; color: var(--muted); font-size: .875rem; font-weight: 600; font-variant-numeric: tabular-nums; text-align:end; }
.fs-milestones { position: relative; }
.fs-milestones i { position: absolute; top: 2px; width: 4px; height: 4px; margin-inline-start: -2px; border-radius: 50%; background: #aeaeb2; }
.fs-milestones i[data-passed="true"] { background: rgb(255 255 255 / .9); }

/* Norm */
.fs-norm-head { display: flex; align-items: center; gap: 12px; }
.fs-norm-mark { flex-shrink: 0; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: rgb(142 142 147 / .14); color: var(--muted); }
.fs-norm-mark .icon { width: 19px; height: 19px; }
.fs-norm[data-met="true"] .fs-norm-mark { background: linear-gradient(#34d277, #16b05a); color: #fff; }
.fs-norm p { margin-top: 2px; color: var(--muted); font-size: .875rem; line-height: 1.35; }
.fs-chips { display: flex; gap: 8px; }
.fs-chip { flex: 1 1 0; min-width: 0; display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 32px; padding: 0 6px; border-radius: 999px; background: rgb(142 142 147 / .1); color: var(--muted); font-size: .8125rem; font-weight: 600; white-space: nowrap; }
.fs-chip .icon { flex-shrink: 0; width: 13px; height: 13px; }
.fs-chip[data-state="done"] { background: rgb(22 176 90 / .15); color: var(--accent-ink); }
.fs-chip[data-state="off"] { opacity: .6; }
.fs-no-data { justify-items: center; gap: 6px; padding: 26px 16px; text-align: center; }
.fs-no-data p { color: var(--muted); font-size: .875rem; }

/* Reactions and the rare actions */
.fs-reactions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 6px; }
.modal-body .fs-react { min-width: 0; min-height: 48px; padding: 0 8px; border-radius: 999px; font-size: .9375rem; font-weight: 600; white-space: nowrap; }
.fs-react[data-kind="cheer"] { background: var(--accent); color: #fff; }
.fs-react[data-kind="cheer"]:hover:not(:disabled) { background: var(--accent-ink); color: #fff; }
.fs-react[data-kind="nudge"] { background: #ff950024; color: #b85c00; }
.fs-react[data-kind="nudge"]:hover:not(:disabled) { background: #ff950038; color: #b85c00; }
.fs-react:disabled { opacity: .55; cursor: default; }
.fs-menu { display: grid; overflow: hidden; border-radius: var(--radius); background: var(--surface); }
.fs-row { width: 100%; min-height: 50px; padding: 0 16px; border: 0; background: none; color: var(--ink); font: inherit; font-size: 1rem; text-align:start; cursor: pointer; }
.fs-row + .fs-row { box-shadow: inset 0 1px 0 var(--line); }
.fs-row:hover { background: rgb(0 0 0 / .03); }
.fs-row-danger { color: #e0241b; }
.fs-footnote { padding: 2px 16px; color: var(--muted); font-size: .8125rem; line-height: 1.35; text-align: center; }
.fs-day-button:focus-visible, .fs-week-page:focus-visible, .fs-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

@media (prefers-reduced-motion: reduce) {
  .fs-live { animation: none; }
  .fs-mark { transition: none; }
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  dialog:has(.fs) { background: #f2f2f7; }
}
