/* =====================================================================
   Clasa 0B — application shell (frame, navigation, persona switcher)
   Prefix: sh-. Reads tokens only. Screens should NOT restyle sh-*;
   they use the layout contract below.

   LAYOUT CONTRACT FOR SCREENS
     #sh-view.sh-view          content column (padding-inline = gutter,
                               max-width by data-layout)
       data-layout="default"   max var(--content-max) 1180px
       data-layout="wide"      full width of the main column
       data-layout="reading"   max var(--reading-max) 680px
       data-layout="full"      no padding, no max (edge-to-edge)
     .sh-bleed                 child element that escapes the gutter
                               (edge-to-edge strips inside default layout)
     .sh-sticky                sticky sub-header under the top bar
                               (top: var(--sh-top-h))
     --sh-top-h                height of the sticky top bar (all sizes)
     --sh-bottom-space         space reserved at the bottom (tab bar +
                               persona pill on phones, 0 on desktop)
   Breakpoints: mobile ≤767 (bottom tabs + floating persona pill),
   tablet 768–1099 (icon rail), desktop ≥1100 (full sidebar).
   ===================================================================== */

:root {
  --sh-top-h: calc(var(--appbar-h) + var(--safe-top));
  --sh-rail-w: 84px;
  --sh-bottom-space: calc(var(--tabbar-h) + var(--safe-bottom) + 64px);
}
@media (min-width: 768px) { :root { --sh-top-h: 64px; --sh-bottom-space: var(--sp-6); } }

html { scroll-padding-top: calc(var(--sh-top-h) + 12px); }
body { background: var(--paper); }

.sh { min-height: 100dvh; }
.sh-body { min-width: 0; display: flex; flex-direction: column; min-height: 100dvh; }
.sh-main { flex: 1; min-width: 0; outline: none; }

/* ---------------- content column ---------------- */
.sh-view {
  width: 100%; max-width: calc(var(--content-max) + 2 * var(--gutter)); margin-inline: auto;
  padding: 0 calc(var(--gutter) + var(--safe-right)) var(--sp-8) calc(var(--gutter) + var(--safe-left));
  min-width: 0;
}
.sh-view[data-layout="wide"] { max-width: none; }
.sh-view[data-layout="reading"] { max-width: calc(var(--reading-max) + 2 * var(--gutter)); }
.sh-view[data-layout="full"] { max-width: none; padding-inline: 0; }
.sh-bleed { margin-inline: calc(-1 * var(--gutter)); }
.sh-sticky { position: sticky; top: var(--sh-top-h); z-index: var(--z-sticky); background: var(--paper); }

/* Large page title (collapses into the top bar on scroll) */
.sh-pagehead { padding-top: var(--sp-5); }
.sh-pagehead__row { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; }
.sh-pagehead__row .ui-pagehead__title { min-width: 0; flex: 1 1 260px; }
.sh-pagehead__actions { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
@media (min-width: 1100px) { .sh-pagehead { padding-top: var(--sp-7); padding-bottom: var(--sp-5); } }

/* ---------------- top bar ---------------- */
.sh-top {
  position: sticky; top: 0; z-index: var(--z-header);
  display: flex; align-items: center; gap: var(--sp-2);
  min-height: var(--sh-top-h); padding: var(--safe-top) calc(var(--sp-2) + var(--safe-right)) 0 calc(var(--gutter) + var(--safe-left));
  background: var(--paper); border-bottom: 1px solid transparent;
  transition: background-color var(--dur-2) var(--ease-standard), border-color var(--dur-2) var(--ease-standard);
}
.sh-top.is-collapsed { background: var(--surface-glass); -webkit-backdrop-filter: saturate(1.6) blur(18px); backdrop-filter: saturate(1.6) blur(18px); border-bottom-color: var(--line); }
.sh-top__lead { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; flex: 1; }
.sh-top__brand .ui-brand__tile { width: 34px; height: 34px; font-size: 14px; border-radius: 10px; background: var(--brand-tile-bg); color: var(--brand-tile-fg); }
.sh-top__title {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-weight: var(--fw-semibold); font-size: 16px; letter-spacing: -.01em;
  opacity: 0; transform: translateY(6px); transition: opacity var(--dur-2) var(--ease-standard), transform var(--dur-2) var(--ease-standard);
}
.sh-top.is-collapsed .sh-top__title { opacity: 1; transform: none; }
.sh-top__actions { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.sh-top__search { display: none; }
.sh-top__add { display: none; }
.sh-top__me { display: grid; place-items: center; width: var(--touch); height: var(--touch); border-radius: 50%; }
.sh-top__me:hover .ui-avatar { box-shadow: 0 0 0 2px var(--line-strong); }
.sh-bell .ui-dot { top: 10px; right: 10px; }

/* child pill (appbar) */
.sh-childpill {
  position: relative; display: inline-flex; align-items: center; gap: 7px; min-height: 34px; padding: 0 10px 0 5px; margin-right: 4px;
  border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--sh-1);
  font-size: 13px; font-weight: var(--fw-semibold); color: var(--ink); max-width: 150px;
}
.sh-childpill > span:not(.ui-avatar) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sh-childpill .ui-avatar--child { box-shadow: 0 0 0 1.5px var(--surface), 0 0 0 3px var(--accent); }
.sh-childpill::after { content: ""; position: absolute; inset: -6px -2px; }
.sh-childpill:hover { border-color: var(--line-strong); }

/* ---------------- persona switcher pill ---------------- */
.sh-persona-pill {
  position: relative; display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 0 10px 0 5px;
  border-radius: var(--r-pill); border: 1px dashed var(--line-strong); background: var(--surface);
  color: var(--ink-2); font-size: 12.5px; white-space: nowrap; max-width: 220px;
  transition: border-color var(--dur-1), box-shadow var(--dur-2), transform var(--dur-1) var(--ease-standard);
}
.sh-persona-pill::after { content: ""; position: absolute; inset: -5px -2px; }
.sh-persona-pill:hover { border-color: var(--subtle); }
.sh-persona-pill:active { transform: scale(.97); }
.sh-persona-pill__txt { overflow: hidden; text-overflow: ellipsis; }
.sh-persona-pill__k { color: var(--muted); }
.sh-persona-pill b { font-weight: var(--fw-semibold); color: var(--ink); }
.sh-persona-pill .ui-i { color: var(--muted); }
.sh-persona-pill--top { display: none; }
.sh-persona-pill--float {
  position: fixed; z-index: var(--z-fab);
  right: calc(12px + var(--safe-right)); bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 12px);
  background: var(--surface-glass); -webkit-backdrop-filter: saturate(1.6) blur(14px); backdrop-filter: saturate(1.6) blur(14px);
  box-shadow: var(--sh-2); border-style: solid; border-color: var(--line);
  transition: transform var(--dur-2) var(--ease-standard), opacity var(--dur-2);
}
/* Phones: the pill slides away while scrolling down (so it never sits on primary actions), back on scroll up / at the end */
.sh-persona-pill--float.is-away { transform: translateY(calc(100% + 24px)); opacity: 0; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .sh-persona-pill--float { transition: none; } }

/* ---------------- bottom tab bar (phones) ---------------- */
.sh-tabbar--n3 { grid-template-columns: repeat(3, 1fr); }
.sh-tabbar--n4 { grid-template-columns: repeat(4, 1fr); }
.sh-tabbar .ui-tabbar__item, .sh-tabbar .ui-tabbar__add { min-width: 0; }
.sh-tab__label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-inline: 2px; }
.sh-tabbar .ui-tabbar__item:focus-visible, .sh-tabbar .ui-tabbar__add:focus-visible { outline-offset: -2px; }

/* ---------------- sidebar / rail ---------------- */
.sh-side { display: none; }
.sh-side__brand { padding: 4px 6px var(--sp-4); }
.sh-side__brand .ui-brand__tile { background: var(--brand-tile-bg); color: var(--brand-tile-fg); }
.sh-side__brandtext { display: grid; min-width: 0; }
.sh-side__nav { display: flex; flex-direction: column; gap: 2px; }
.sh-side__sep { display: block; height: var(--sp-2); }
.sh-side__label { padding: var(--sp-5) 12px var(--sp-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sh-side__add { justify-content: flex-start; gap: 10px; margin: 0 0 var(--sp-2); padding-inline: 12px; }
.sh-side__add .ui-btn__count { margin-left: auto; }
.sh-side__add.is-current { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--primary); }
.sh-nav-item__label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sh-side__foot { margin-top: auto; padding-top: var(--sp-3); border-top: 1px solid var(--line); display: grid; gap: 2px; }
.sh-me {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 56px; margin-top: var(--sp-2); padding: 8px 10px;
  border-radius: var(--r-md); text-align: left; color: var(--ink); transition: background-color var(--dur-1);
}
.sh-me:hover { background: var(--surface-3); }
.sh-me__txt { display: grid; min-width: 0; flex: 1; }
.sh-me__txt b { font-size: 14px; font-weight: var(--fw-semibold); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sh-me__txt span { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sh-me__chev { color: var(--subtle); }

/* pilot (decisions 26.09): phase-2 banner for school personas + pilot note in the persona sheet */
.sh-phase {
  display: flex; align-items: flex-start; gap: 8px; box-sizing: border-box; width: calc(100% - 2 * var(--gutter)); max-width: var(--content-max);
  margin: var(--sp-3) auto 0; padding: 8px 12px;
  border-radius: var(--r-md); background: var(--info-soft); color: var(--info-ink); font-size: 13px; line-height: 1.4;
}
.sh-phase p { margin: 0; min-width: 0; }
.sh-phase .ui-i { flex: none; margin-top: 1px; }
.sh-ps__pilot { display: flex; align-items: flex-start; gap: 8px; margin: 0 0 var(--sp-4); padding: 10px 12px; border-radius: var(--r-md); background: var(--primary-soft); color: var(--ink); font-size: 13.5px; line-height: 1.4; }
.sh-ps__pilot .ui-i { flex: none; margin-top: 2px; color: var(--primary-ink); }
.sh-ps__note { margin: 0; }
.sh-ps__group--phase2 .sh-ps__row { opacity: .92; }

/* footnote */
.sh-footnote { padding: 0 var(--gutter) var(--sh-bottom-space); text-align: center; font-size: 11.5px; color: var(--muted); }
.sh-footnote span { display: inline-flex; align-items: flex-start; gap: 6px; max-width: 60ch; text-align: left; }
.sh-footnote .ui-i { margin-top: 1px; }

/* ---------------- tablet: icon rail ---------------- */
@media (min-width: 768px) {
  .sh { display: grid; grid-template-columns: var(--sh-rail-w) minmax(0, 1fr); }
  .sh-tabbar { display: none; }
  .sh-persona-pill--float { display: none; }
  .sh-persona-pill--top { display: inline-flex; margin-left: var(--sp-2); }
  .sh-top { padding: 0 var(--gutter); }
  .sh-top__brand { display: none; }
  .sh-top__me { display: none; }
  .sh-top__add { display: inline-flex; }
  .sh-side {
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100dvh; overflow-y: auto; overflow-x: hidden;
    padding: var(--sp-4) 12px; border-right: 1px solid var(--line); background: var(--paper); scrollbar-width: thin;
  }
  .ui-toasts { bottom: var(--sp-6); }
  .sh-footnote { padding-bottom: var(--sp-6); }
}
@media (min-width: 768px) and (max-width: 1099px) {
  .sh-side__brand { padding: 0 0 var(--sp-3); display: flex; justify-content: center; }
  .sh-side__brandtext, .sh-side__label, .sh-me__txt, .sh-me__chev, .sh-side__add .ui-btn__count { display: none; }
  .sh-nav-item__label { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .sh-side__sep { height: var(--sp-3); }
  .sh-side .ui-nav-item { justify-content: center; padding: 0; min-height: 48px; position: relative; }
  .sh-side .ui-nav-item .ui-i { width: 22px; height: 22px; }
  .sh-side .ui-nav-item .ui-count { position: absolute; top: 4px; right: 6px; margin: 0; min-width: 18px; height: 18px; font-size: 10px; }
  .sh-side__add { justify-content: center; padding: 0; width: 56px; min-height: 48px; align-self: center; border-radius: var(--r-fab); margin-bottom: var(--sp-3); }
  .sh-me { justify-content: center; padding: 6px 0; min-height: 52px; }
  .sh-side [data-sh-tip] { position: relative; }
}

/* ---------------- desktop: full sidebar ---------------- */
@media (min-width: 1100px) {
  .sh { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .sh-side { padding: var(--sp-5) var(--sp-4) var(--sp-4); }
  .sh-top { min-height: 64px; gap: var(--sp-3); }
  .sh-top__lead { flex: 0 1 auto; max-width: 30%; }
  .sh-top__title:empty { display: none; }
  .sh-top__search { display: flex; flex: 1 1 320px; max-width: 460px; }
  .sh-top__add { display: inline-flex; }
  .sh-top__actions { margin-left: auto; gap: var(--sp-2); }
  .sh-top:not(.is-collapsed) .sh-top__lead { display: none; }
}

/* rail hover labels (to the right of the icon) */
@media (min-width: 768px) and (max-width: 1099px) and (hover: hover) {
  .sh-side [data-sh-tip]::after {
    content: attr(data-sh-tip); position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%);
    padding: 6px 10px; border-radius: var(--r-sm); background: var(--inverse-surface); color: var(--on-inverse-surface);
    font-size: 12px; font-weight: 600; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity var(--dur-1); z-index: var(--z-tooltip);
  }
  .sh-side [data-sh-tip]:hover::after, .sh-side [data-sh-tip]:focus-visible::after { opacity: 1; }
  .sh-side { overflow: visible; }
}

/* ---------------- kid mode ---------------- */
.sh[data-kind="child"] { --tabbar-h: 78px; }
.sh[data-kind="child"] .sh-tabbar { padding-top: 8px; }
.sh[data-kind="child"] .ui-tabbar__item { font-size: 12.5px; font-weight: 700; gap: 4px; }
.sh[data-kind="child"] .ui-tabbar__pill { width: 64px; height: 38px; }
.sh[data-kind="child"] .ui-tabbar__item .ui-i { width: 27px; height: 27px; }
.sh[data-kind="child"] .ui-tabbar__item[aria-current="page"] .ui-tabbar__pill { background: var(--accent-soft); }
.sh[data-kind="child"] .ui-tabbar__item[aria-current="page"] { color: var(--accent-ink); }
.sh-kidhello { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-size: 20px; letter-spacing: var(--ls-display); white-space: nowrap; }
.sh[data-kind="child"] .sh-top__title { display: none; }
.sh-kidlock { color: var(--muted); }
@media (min-width: 768px) {
  .sh[data-kind="child"] .sh-side .ui-nav-item[aria-current="page"] { background: var(--accent-soft); color: var(--accent-ink); }
  .sh[data-kind="child"] .sh-side .ui-nav-item[aria-current="page"] .ui-i { color: var(--accent-ink); }
}

/* PIN pad */
.sh-pin { display: grid; justify-items: center; gap: var(--sp-4); padding-bottom: var(--sp-2); }
.sh-pin__hint { color: var(--muted); font-size: 14px; text-align: center; }
.sh-pin__dots { display: flex; gap: 14px; }
.sh-pin__dots span { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--control-border); transition: background-color var(--dur-1), transform var(--dur-2) var(--ease-spring); }
.sh-pin__dots span.is-on { background: var(--primary); border-color: var(--primary); transform: scale(1.05); }
.sh-pin__dots.is-error span { border-color: var(--danger); background: var(--danger-soft); animation: sh-shake .35s; }
@keyframes sh-shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.sh-pin__pad { display: grid; grid-template-columns: repeat(3, 72px); gap: 12px; }
.sh-pin__key { height: 60px; border-radius: 20px; background: var(--surface-2); border: 1px solid var(--line); font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.sh-pin__key:hover { background: var(--surface-3); }
.sh-pin__key:active { transform: scale(.95); }
.sh-pin__key--del { display: grid; place-items: center; color: var(--muted); }
.sh-pin__demo { margin-top: var(--sp-1); }

/* ---------------- persona switcher sheet ---------------- */
.sh-ps__intro { font-size: 14px; color: var(--muted); margin-bottom: var(--sp-4); }
.sh-ps__group { display: grid; gap: var(--sp-2); margin-top: var(--sp-5); }
.sh-ps__group:first-of-type { margin-top: 0; }
.sh-ps__row.is-current { background: var(--primary-soft); }
.sh-ps__row .ui-row__sub { -webkit-line-clamp: 2; }
.sh-ps__check { color: var(--primary); }
.sh-ps__reset { gap: var(--sp-2); }

/* ---------------- states ---------------- */
.sh-state { padding-top: var(--sp-8); }
.sh-state--denied .ui-empty__art { background: var(--surface-3); color: var(--ink-2); }
.sh-state--error .ui-empty__art { background: var(--danger-soft); color: var(--danger-ink); }
.sh-denied { display: flex; gap: var(--sp-3); align-items: flex-start; padding: 14px 16px; border-radius: var(--r-md); background: var(--surface-2); border: 1px dashed var(--line-strong); color: var(--ink-2); }
.sh-denied > .ui-i { color: var(--muted); margin-top: 2px; }
.sh-denied__t { font-weight: var(--fw-semibold); color: var(--ink); }
.sh-denied__r { font-size: 13.5px; color: var(--muted); margin-top: 2px; }
.sh-demo-tag { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 6px; background: var(--surface-3); color: var(--muted); font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; vertical-align: middle; }
.sh-demo-mark { color: var(--muted); font-weight: 400; font-size: .9em; }
.sh-state-duplicat .ui-i { color: var(--st-primit-fg); }
.sh-state-de_incadrat .ui-i { color: var(--warning); }

/* ---------------- photos (placeholder art + consent) ---------------- */
.sh-photo { isolation: isolate; }
.sh-art { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; transition: transform var(--dur-3) var(--ease-standard), filter var(--dur-2); }
.sh-photo:hover .sh-art { transform: scale(1.03); }
.sh-photo.is-blurred .sh-art { filter: blur(9px) saturate(.5); transform: scale(1.15); }
.sh-photo__badge, .sh-photo__pending {
  position: absolute; left: 6px; bottom: 6px; z-index: 1; display: inline-flex; align-items: center; gap: 4px; max-width: calc(100% - 12px);
  padding: 3px 7px; border-radius: 7px; background: var(--scrim-media); color: var(--on-media); font-size: 10.5px; font-weight: 600; line-height: 1.2;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sh-photo__pending { left: auto; right: 6px; top: 6px; bottom: auto; }
/* Narrow tiles (dense grids): badges collapse to their icon; the full text stays in the aria-label/title */
.sh-photo { container-type: inline-size; }
@container (max-width: 128px) {
  .sh-photo__badge, .sh-photo__pending { padding: 4px; gap: 0; }
  .sh-photo__badge .sh-photo__txt, .sh-photo__pending .sh-photo__txt { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
/* file sheet caption: icon inline with the text */
.sh-file__note { display: flex; gap: 6px; align-items: flex-start; }
.sh-file__note .ui-i { flex: none; margin-top: 2px; }
/* who-can-see: summary rows for viewers outside the owning family */
.sh-who__count { color: var(--muted); font-size: var(--fs-caption); }

/* ---------------- sheets: who / audience / share / file ---------------- */
.sh-who__head { display: grid; gap: var(--sp-2); justify-items: start; margin-bottom: var(--sp-4); }
.sh-who__group { margin-top: var(--sp-5); display: grid; gap: var(--sp-1); }
.sh-who__not .ui-row__title { font-weight: 500; color: var(--ink-2); }
.sh-aud { border: 0; margin: 0; padding: 0; min-width: 0; }
.sh-aud__people { margin-top: var(--sp-4); display: grid; gap: var(--sp-2); }
.sh-aud__person { cursor: pointer; }
.sh-aud__note { margin-top: var(--sp-3); min-height: 1.4em; }
.sh-share__sec { display: grid; gap: var(--sp-3); margin-top: var(--sp-5); }
.sh-share__sec:first-child { margin-top: 0; }
.sh-share__presets { margin-bottom: var(--sp-2); }
.sh-share__preview .ui-callout p { font-size: 13.5px; }
.sh-file { display: grid; gap: var(--sp-4); }
.sh-file__page { display: grid; place-items: center; gap: var(--sp-3); min-height: 220px; padding: var(--sp-6); border-radius: var(--r-md); background: var(--paper-2); border: 1px solid var(--line); color: var(--muted); text-align: center; font-size: 14px; }
.sh-child__more { margin-top: var(--sp-3); display: grid; gap: var(--sp-2); }
.sh-notifs .ui-row { align-items: flex-start; }

@media (prefers-reduced-motion: reduce) { .sh-top__title { transform: none; } }
@media (max-width: 767px) { .sh[data-kind="child"] { --sh-bottom-space: calc(78px + var(--safe-bottom) + 64px); } }

/* denied state: secondary way back */
.sh-state__alt { text-align: center; margin-top: calc(var(--sp-2) * -1); font-size: var(--fs-caption); }
.sh-state__alt a { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; display: inline-flex; min-height: 44px; align-items: center; }
.sh-top__spacer { flex: 1; }

/* ---- Language switch (RO | EN) — App.shared.languageSwitcher() ---- */
.sh-lang { flex: none; }
.sh-lang--compact .ui-seg__btn { min-width: 36px; padding-inline: 8px; font-size: 12px; letter-spacing: .04em; }
.sh-top__lang { display: none; margin-inline: 4px; }
@media (min-width: 1100px) { .sh-top__lang { display: inline-flex; } }
.sh-ps__lang { display: grid; gap: 6px; margin-top: var(--sp-3); }

/* ---- "+" sheet: App.quickAdd (js/core/quickadd.js) ---- */
.sh-qa { display: grid; gap: var(--sp-5); }
.sh-qa__group { display: grid; gap: var(--sp-2); min-width: 0; }
.sh-qa__label { margin: 0; }
.sh-qa__row { align-items: flex-start; }
.sh-qa__row .ui-row__body { min-width: 0; }
.sh-qa__row--ai { border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface-2); }
.sh-qa__row--ai .ui-row__lead { color: var(--primary); }
.sh-qa__note { display: inline-flex; align-items: center; gap: 4px; margin-top: 2px; font-size: var(--fs-caption); color: var(--muted); overflow-wrap: anywhere; }

/* ---- 26.09: shared components (App.shared) — visibility, history/undo, who's in charge, recurrence ---- */
/* tiny avatar stack "who sees it" (visibilityControl) */
.sh-vis { position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 32px; max-width: 100%; padding: 2px 10px 2px 4px;
  border: 1px solid var(--line); border-radius: var(--r-pill); background: var(--surface); color: var(--muted); font-size: var(--fs-caption); line-height: 1.2; cursor: pointer; }
.sh-vis::after { content: ""; position: absolute; inset: -6px 0; } /* 44px hit area */
.sh-vis:hover { border-color: var(--line-strong); color: var(--ink-2); }
.sh-vis:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.sh-vis__label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sh-vis-sheet { display: grid; gap: var(--sp-3); }
.sh-vis__chips { gap: var(--sp-2); }
.sh-vis__chip[disabled] { opacity: .45; cursor: not-allowed; }
.sh-vis__more { margin-top: var(--sp-2); }

/* history row + change notifications */
.sh-hist { align-items: flex-start; }
.sh-hist .ui-row__body { min-width: 0; }
.sh-hist.is-undone .ui-row__title { text-decoration: line-through; text-decoration-thickness: 1px; color: var(--muted); }
.sh-hist__meta { font-size: var(--fs-caption); }
.sh-notif { display: grid; }
.sh-notif__see { color: var(--primary-ink); font-weight: var(--fw-medium); }
.sh-notif__undo, .sh-notif__undone { padding: 0 var(--sp-4) var(--sp-2) calc(var(--sp-4) + 44px); margin: 0; }

/* who's in charge (assigneePicker) and recurrence chips: radio/checkbox inside a chip */
.sh-asg { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: var(--sp-2); }
.sh-asg__chips, .sh-recur .ui-chips { gap: var(--sp-2); }
.sh-asg__chip, .sh-recur__chip { cursor: pointer; padding-inline: 12px; }
.sh-asg__chip input, .sh-recur__chip input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.sh-asg__chip:has(input:checked), .sh-recur__chip:has(input:checked) { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.sh-asg__chip:has(input:focus-visible), .sh-recur__chip:has(input:focus-visible) { box-shadow: var(--focus-ring); }
.sh-asg__chip .ui-avatar { margin-left: -6px; }
.sh-asg__other { max-width: 360px; }

/* recurrencePicker */
.sh-recur { display: grid; gap: var(--sp-3); min-width: 0; }
.sh-recur__body { display: grid; gap: var(--sp-4); min-width: 0; padding: var(--sp-3); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); }
.sh-recur__body[hidden], .sh-recur__set[hidden] { display: none; }
.sh-recur__set { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: var(--sp-2); }
.sh-recur__day { min-width: 44px; justify-content: center; }
.sh-recur__row { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }
.sh-recur__row .ui-input { flex: 1 1 160px; min-width: 0; }
.sh-recur__start { max-width: 240px; }
.sh-recur__ends { display: grid; grid-template-columns: minmax(0, auto) minmax(0, 1fr); gap: 0 var(--sp-3); align-items: center; }
.sh-recur__ends .ui-radio { min-height: 44px; padding: 6px 0; }
.sh-recur__endval { max-width: 200px; }
.sh-recur__endval:disabled { opacity: .5; }
@media (max-width: 420px) { .sh-recur__ends { grid-template-columns: minmax(0, 1fr); } .sh-recur__endval { margin-bottom: var(--sp-2); } }
.sh-recur__preview { display: grid; gap: 4px; min-width: 0; }
.sh-recur__preview > .ui-label, .sh-recur__preview > .ui-caption { margin: 0; }
.sh-recur__summary { margin: 4px 0 0; font-weight: var(--fw-semibold); color: var(--ink); overflow-wrap: anywhere; }
.sh-recur__dates { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 0 var(--sp-3); max-height: 280px; overflow-y: auto; }
.sh-recur__occ { padding: 6px 0; min-height: 40px; }
.sh-recur__occ input:not(:checked) + .ui-check__text { text-decoration: line-through; color: var(--muted); }

/* 27.09 family mode — "View as…": personas of modules that are off, collapsed */
.sh-ps__off > summary { list-style: none; }
.sh-ps__off > summary::-webkit-details-marker { display: none; }
.sh-ps__off-sum { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); min-height: 44px; cursor: pointer; border-radius: var(--r-md); }
.sh-ps__off-sum:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.sh-ps__off-chev { color: var(--muted); transition: transform .15s ease; }
.sh-ps__off[open] .sh-ps__off-chev { transform: rotate(180deg); }
.sh-ps__off .sh-ps__row { opacity: .85; }
/* share sheet: invitation link */
.sh-share__invite { display: grid; gap: var(--sp-3); }
.sh-share__invite .ui-input { font-family: var(--font-mono, ui-monospace, monospace); font-size: 14px; }
