/* ===========================================================================
   ui.css -- the shared controls, in Apple's (iOS 26) shapes.
   Every color and size comes from the tokens at the top of app.css, so all of
   this follows Dark Mode, the staff theme color and the reader's text size.

     navigation bar ........ .navbar  (+ .nav-large, the big page title)
     tab bar ............... .tabbar  (floating glass capsule, phones only)
     grouped lists ......... .list / .row
     buttons ............... button, .btn, .btn-secondary, .btn-gray, .btn-plain
     forms ................. inputs, .field, .switch, .seg
     sheets ................ dialog.sheet, dialog.action-sheet  (ui.js)
     empty states .......... .empty
   =========================================================================== */

/* The hidden attribute always wins. Without this, any rule that sets
   display (.row is flex, .search-clear is grid) silently overrides it -- the
   search filter marked rows hidden and they stayed on screen. */
[hidden] { display: none !important; }

/* ---- Navigation bar --------------------------------------------------------
   Transparent at the top of the page, frosted glass once content scrolls
   under it (ui.js sets body.nav-scrolled). Top-level pages carry a large
   title in the page itself (.nav-large); its small twin in the bar fades in
   when the large one scrolls away, as on iPhone. */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  padding-top: var(--safe-t);
  transition: background-color 0.2s, box-shadow 0.2s;
}
body.nav-scrolled .navbar {
  background: var(--glass);
  -webkit-backdrop-filter: blur(20px) saturate(1.8);
  backdrop-filter: blur(20px) saturate(1.8);
  box-shadow: 0 0.5px 0 var(--sep);
}
.navbar-in {
  position: relative;
  height: var(--nav-h);
  max-width: 680px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 max(var(--gutter), env(safe-area-inset-right, 0px)) 0 max(var(--gutter), env(safe-area-inset-left, 0px));
}
body.page-wide .navbar-in { max-width: 1240px; }
.nav-lead, .nav-trail { display: flex; align-items: center; gap: 8px; flex: none; position: relative; z-index: 1; }
.nav-trail { margin-left: auto; }
/* back button + help, bell and photo: the title flows left of the buttons */
.navbar.trail-full .nav-title { position: static; flex: 1; min-width: 0; text-align: left; }
.navbar.trail-full .nav-title-html { justify-content: flex-start; }
.nav-title {
  position: absolute;
  left: 76px;
  right: 76px;
  text-align: center;
  font: 600 var(--fs-headline)/1.2 var(--font);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  transition: opacity 0.2s;
}
.navbar.has-large .nav-title, body:has(.nav-large) .navbar .nav-title:not(.nav-title-html) { opacity: 0; }
body.nav-collapsed .navbar.has-large .nav-title, body.nav-collapsed:has(.nav-large) .navbar .nav-title { opacity: 1; }

/* Round glass bar buttons (back, actions). 44x44: Apple's minimum tap size. */
.nav-btn {
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 22px;
  display: inline-grid;
  place-items: center;
  flex: none;
  position: relative;
  background: var(--glass);
  -webkit-backdrop-filter: blur(16px) saturate(1.6);
  backdrop-filter: blur(16px) saturate(1.6);
  border: 0.5px solid var(--glass-edge);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.07);
  color: var(--label);
  text-decoration: none;
}
@media (hover: hover) { .nav-btn:hover { background: var(--glass-solid); text-decoration: none; } }
.nav-btn:active { opacity: 0.7; }
.nav-btn .icon { width: 22px; height: 22px; stroke-width: 1.9; }
.nav-btn-text { width: auto; padding: 0 16px; font: 600 var(--fs-body)/1 var(--font); }
.nav-btn-primary { background: var(--tint-fill); color: var(--on-tint); border-color: transparent; }
.nav-btn .count-badge { position: absolute; top: -2px; right: -3px; }
/* Your photo, top right: the way into Profile. */
.nav-avatar { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; flex: none; }
.nav-avatar .avatar, .nav-avatar .avatar-img { width: 36px; height: 36px; font-size: 0.8rem; }

.nav-large {
  font: 700 var(--fs-large)/1.2 var(--font-display);
  letter-spacing: 0.01em;
  margin: 0 0 12px;
  overflow-wrap: anywhere;
}
.nav-large-sub { margin: -10px 0 14px; color: var(--label-2); font-size: var(--fs-subhead); }
.nav-large-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.nav-large-row .nav-large { flex: 1; min-width: 0; }

/* ---- Tab bar ---------------------------------------------------------------
   iOS 26: a frosted capsule floating above the content, filled icon and a
   tinted pill on the current tab. Labels are a fixed 11px on purpose: Apple
   keeps tab labels out of Dynamic Type so a large text size can't push the
   bar off the screen. */
.tabbar {
  position: fixed;
  z-index: 100;
  left: max(12px, env(safe-area-inset-left, 0px));
  right: max(12px, env(safe-area-inset-right, 0px));
  bottom: max(var(--tabbar-gap), calc(var(--safe-b) - 10px));
  max-width: 520px;
  height: var(--tabbar-h);
  margin: 0 auto;
  padding: 4px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  border-radius: 32px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(18px) saturate(1.8);
  backdrop-filter: blur(18px) saturate(1.8);
  border: 0.5px solid var(--glass-edge);
  box-shadow: var(--float-shadow);
}
.tab {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 1px;
  min-width: 0;
  border-radius: 28px;
  color: var(--label);
  font: 600 11px/13px var(--font);
  letter-spacing: 0;
  text-decoration: none;
  white-space: nowrap;
}
@media (hover: hover) { .tab:hover { text-decoration: none; background: var(--fill); } }
.tab:active { opacity: 0.7; }
.tab .icon { width: 27px; height: 27px; stroke-width: 1.7; }
.tab.on { color: var(--tint); background: var(--tint-soft); }
.tab.on .icon { fill: currentColor; }
.tab.on .icon .k { fill: var(--glass-solid); stroke: var(--glass-solid); }
.tab .count-badge { position: absolute; top: 3px; left: calc(50% + 5px); }
body.no-tabbar .tabbar { display: none; }
body.no-tabbar { padding-bottom: calc(var(--safe-b) + 16px); }

/* No frosted glass where the reader asked for less transparency, or where the
   browser can't blur: solid bars instead (Apple: never depend on glass). */
@media (prefers-reduced-transparency: reduce) {
  .tabbar, .nav-btn, body.nav-scrolled .navbar, .menu, .glass { background: var(--glass-solid); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .tabbar, .nav-btn, body.nav-scrolled .navbar, .menu, .glass { background: var(--glass-solid); }
}

/* ---- Counts and dots -------------------------------------------------------- */
.count-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--badge);
  color: #fff;
  font: 600 12px/18px var(--font);
  letter-spacing: 0;
  text-align: center;
  display: inline-block;
}
.dot-unread { width: 10px; height: 10px; border-radius: 50%; background: var(--tint); flex: none; display: inline-block; }

/* ---- Grouped lists (Settings-style) ---------------------------------------- */
.list {
  background: var(--card);
  border-radius: var(--r-card);
  overflow: hidden;
  margin: 0 0 24px;
  padding: 0;
  list-style: none;
}
.list-pad { padding: 14px 16px; }
.list-pad > div > :first-child { margin-top: 0; }
.list-pad > div > :last-child { margin-bottom: 0; }
.list-head {
  font-size: var(--fs-footnote);
  line-height: 1.35;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--label-2);
  margin: 0;
  padding: 0 16px 7px;
  font-weight: 400;
}
.list-foot {
  font-size: var(--fs-footnote);
  line-height: 1.35;
  color: var(--label-2);
  margin: -16px 0 24px;
  padding: 0 16px;
}
.row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  width: 100%;
  margin: 0;
  padding: 11px 16px;
  color: var(--label);
  background: none;
  border: 0;
  border-radius: 0;
  font: inherit;
  font-weight: 400;
  text-align: left;
  text-decoration: none;
  cursor: default;
}
a.row, button.row, label.row { cursor: pointer; }
.row + .row::before,
.row-wrap + .row-wrap::before,
.row + .row-wrap::before,
.row-wrap + .row::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: var(--sep-inset, 16px);
  border-top: 0.5px solid var(--sep);
  pointer-events: none;
}
.row-wrap { position: relative; }
.list.with-icons { --sep-inset: 58px; }
.list.with-avatars { --sep-inset: 72px; }
.list.with-thumbs { --sep-inset: 82px; }
@media (hover: hover) { a.row:hover, button.row:hover { background: var(--fill); text-decoration: none; } }
a.row:active, button.row:active, label.row:active { background: var(--fill-2); }
.row-main { flex: 1; min-width: 0; }
.row-main > .row-title, .row-main > .row-sub, .row-main > .row-top { display: block; }
.row-main > .row-top { display: flex; }
.row-title { font-size: var(--fs-body); line-height: 1.3; overflow-wrap: anywhere; }
.row-title.b, .row-title strong { font-weight: 600; }
.row-sub { font-size: var(--fs-subhead); line-height: 1.33; color: var(--label-2); overflow-wrap: anywhere; }
.row-sub.clamp, .clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.row-top .row-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-meta { font-size: var(--fs-subhead); color: var(--label-2); flex: none; font-variant-numeric: tabular-nums; white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
.row-end { display: flex; align-items: center; gap: 6px; flex: none; color: var(--label-2); font-size: var(--fs-body); }
.row-chev { width: 14px; height: 14px; stroke-width: 2.6; color: var(--label-3); flex: none; }
.row-value { color: var(--label-2); }
.row.destructive, .row.destructive .row-title { color: var(--red); }
.row.center { justify-content: center; }
.row.tint, .row.tint .row-title { color: var(--tint); }
.row-thumb { width: 54px; height: 54px; border-radius: 12px; object-fit: cover; flex: none; display: block; background: var(--fill); }
.row-thumb.wide { width: 92px; height: 54px; border-radius: 10px; }
.row-thumb-blank { display: grid; place-items: center; color: var(--label-2); font: 600 var(--fs-title3)/1 var(--font); }
/* A control floating at the right of a linked row (e.g. Captions). */
.row-float { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); z-index: 1; }
.row-wrap:has(.row-float) > .row { padding-right: 136px; }
/* Buttons under a row's text, lined up with it. */
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 12px 58px; }
.row-actions form { margin: 0; }
.list.with-avatars .row-actions { padding-left: 72px; }
.row-time { width: 72px; flex: none; color: var(--label-2); font-size: var(--fs-subhead); font-variant-numeric: tabular-nums; }

/* Settings-style colored icon tiles. Fixed colors, white glyphs: they read
   the same in light and dark, as Apple's do. */
.tile { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none; color: #fff; background: #8e8e93; }
.tile .icon { width: 19px; height: 19px; stroke-width: 2; }
.tile.blue { background: #2f6fd0; } .tile.green { background: #2f9e4f; } .tile.orange { background: #ee8a12; }
.tile.red { background: #e5483d; } .tile.purple { background: #8a5cd6; } .tile.teal { background: #2a9fb5; }
.tile.indigo { background: #5856d6; } .tile.pink { background: #e0457b; } .tile.gray { background: #8e8e93; }

/* ---- Buttons (C1) -----------------------------------------------------------
   Four styles, all capsules:
     button / .btn ...... Filled: the one main action on a screen
     .btn-secondary ..... Tinted: other actions
     .btn-gray .......... Gray: neutral (Cancel, Not now)
     .btn-plain ......... Text only
   Sizes: default 44pt, .btn-large 50pt, .btn-small 34pt (with a 44pt touch area). */
button, .btn {
  font: 600 var(--fs-body)/1.2 var(--font);
  letter-spacing: -0.01em;
  min-height: 44px;
  padding: 11px 20px;
  border-radius: 999px;
  border: 0;
  background: var(--tint-fill);
  color: var(--on-tint);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  text-decoration: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}
@media (hover: hover) { button:hover, .btn:hover { background: var(--tint-press); text-decoration: none; } }
button:active, .btn:active { opacity: 0.72; }
button:disabled, .btn[aria-disabled="true"] { opacity: 0.4; cursor: default; }
button .icon, .btn .icon { width: 1.15em; height: 1.15em; stroke-width: 2; }

.btn-secondary, button.btn-secondary { background: var(--tint-soft); color: var(--tint); }
@media (hover: hover) { .btn-secondary:hover, button.btn-secondary:hover { background: var(--tint-soft-2); } }
.btn-gray, button.btn-gray { background: var(--fill); color: var(--label); }
@media (hover: hover) { .btn-gray:hover, button.btn-gray:hover { background: var(--fill-2); } }
.btn-plain, button.btn-plain, button.linklike { background: none; color: var(--tint); padding-left: 8px; padding-right: 8px; }
@media (hover: hover) { .btn-plain:hover, button.btn-plain:hover, button.linklike:hover { background: var(--fill); } }
.btn-danger, button.btn-danger { background: var(--red-soft); color: var(--red); }
.btn-danger-fill, button.btn-danger-fill { background: var(--red); color: #fff; }
.btn-large { min-height: 50px; padding: 14px 24px; }
.btn-block { display: flex; width: 100%; }
.btn-small, button.btn-small {
  min-height: 34px;
  padding: 6px 14px;
  font-size: var(--fs-subhead);
  position: relative;
}
/* 34pt to look at, 44pt to hit. */
.btn-small::after { content: ""; position: absolute; inset: -5px -2px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ---- Forms (C7) -------------------------------------------------------------- */
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=search],
input[type=url], input[type=number], input[type=date], input[type=time], input[type=datetime-local],
select, textarea {
  font: 400 var(--fs-body)/1.3 var(--font);
  letter-spacing: -0.01em;
  min-height: 44px;
  padding: 11px 14px;
  border-radius: var(--r-control);
  border: 1px solid var(--sep);
  background: var(--card);
  color: var(--label);
  width: 100%;
  margin: 0;
}
select { appearance: none; -webkit-appearance: none; padding-right: 36px;
  background-image: linear-gradient(45deg, transparent 50%, var(--label-2) 50%), linear-gradient(135deg, var(--label-2) 50%, transparent 50%);
  background-position: calc(100% - 19px) 52%, calc(100% - 14px) 52%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat; }
textarea { resize: none; min-height: 44px; field-sizing: content; max-height: 40vh; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--tint); box-shadow: 0 0 0 3px var(--tint-soft-2); }
.list input, .list select, .list textarea { background: var(--card-2); border-color: transparent; }
input[type=file] { font: inherit; font-size: var(--fs-subhead); color: var(--label-2); max-width: 100%; }
input[type=checkbox], input[type=radio] { accent-color: var(--tint-fill); width: 22px; height: 22px; }

.field { display: grid; gap: 6px; margin: 0 0 16px; }
.field > span:first-child, .field-label { font-size: var(--fs-subhead); font-weight: 600; color: var(--label); }
.field-hint { font-size: var(--fs-footnote); color: var(--label-2); line-height: 1.35; }
.field-error { font-size: var(--fs-footnote); color: var(--red); font-weight: 600; }

/* On/off switch (C3): <input type="checkbox" class="switch">. The knob's
   position, not only its color, says on or off. */
input[type=checkbox].switch {
  appearance: none;
  -webkit-appearance: none;
  width: 51px;
  height: 31px;
  min-height: 0;
  border-radius: 16px;
  background: var(--fill-2);
  position: relative;
  flex: none;
  margin: 0;
  padding: 0;
  border: 0;
  cursor: pointer;
  transition: background-color 0.2s;
}
input[type=checkbox].switch::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.22);
  transition: transform 0.2s;
}
input[type=checkbox].switch:checked { background: #34c759; }
input[type=checkbox].switch:checked::before { transform: translateX(20px); }
input[type=checkbox].switch:focus-visible { outline: 3px solid var(--tint-soft-2); outline-offset: 2px; }
@media (prefers-color-scheme: dark) { input[type=checkbox].switch:checked { background: #30d158; } }

/* Segmented control: <div class="seg"><a class="on">..</a><a>..</a></div>.
   44pt tall overall. */
.seg {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 2px;
  padding: 2px;
  margin: 0 0 18px;
  border-radius: 999px;
  background: var(--fill);
}
.seg > a, .seg > button, .seg > label {
  min-height: 40px;
  display: grid;
  place-items: center;
  padding: 0 10px;
  border-radius: 999px;
  border: 0;
  background: none;
  color: var(--label);
  font: 500 var(--fs-subhead)/1.2 var(--font);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.seg > .on, .seg > [aria-current], .seg > [aria-selected="true"] {
  background: var(--seg-on, var(--card));
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}
@media (prefers-color-scheme: dark) { .seg { --seg-on: #636366; } }
@media (hover: hover) { .seg > a:hover { text-decoration: none; } }

/* Search field: magnifier inside a gray capsule. */
.search-field { display: flex; align-items: center; gap: 6px; min-height: 40px; margin: 0 0 14px; padding: 0 12px; border-radius: 999px; background: var(--fill); color: var(--label-2); }
.search-field .icon { width: 18px; height: 18px; flex: none; stroke-width: 2; }
.search-field input { flex: 1; min-width: 0; min-height: 40px; padding: 8px 0; border: 0; background: none; box-shadow: none; }
.search-field input:focus { box-shadow: none; }
.search-field:focus-within { box-shadow: 0 0 0 3px var(--tint-soft-2); }
/* Hide the browser's own clear control: ui.js adds the same one everywhere. */
.search-field input::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
.search-clear { flex: none; width: 32px; height: 32px; min-height: 32px; padding: 0; margin-right: -6px; border-radius: 50%; background: none; color: var(--label-3); display: grid; place-items: center; position: relative; }
.search-clear::after { content: ""; position: absolute; inset: -6px; }
.search-clear svg { width: 18px; height: 18px; fill: currentColor; }
.search-clear svg path { stroke: var(--bg); stroke-width: 2; stroke-linecap: round; fill: none; }
@media (hover: hover) { .search-clear:hover { background: none; color: var(--label-2); } }
.search-clear[hidden], .filter-none[hidden], .combo-list[hidden] { display: none; }
.filter-none { text-align: center; color: var(--label-2); font-size: var(--fs-subhead); padding: 20px 16px; margin: 0; }
.suggest-list { margin: -8px 0 14px; }
.suggest-list li a { display: flex; align-items: center; width: 100%; min-height: 44px; color: inherit; text-decoration: none; }
.suggest-list li.suggest-search { color: var(--tint); font-weight: 500; }

/* Person picker (ui.js, select[data-combo]): search as you type. The list
   opens in the page flow, so a card's rounded clipping can't cut it off. */
.combo { position: relative; display: inline-block; flex: 1 1 auto; min-width: min(200px, 100%); max-width: 100%; vertical-align: middle; }
.combo-input { width: 100%; }
.combo-native { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.combo-list {
  list-style: none;
  margin: 6px 0 0;
  padding: 4px;
  max-height: 290px;
  overflow-y: auto;
  border-radius: 14px;
  background: var(--glass-solid);
  box-shadow: var(--float-shadow), 0 0 0 0.5px var(--glass-edge);
  position: relative;
  z-index: 20;
}
.combo-list li { padding: 0 12px; min-height: 44px; display: flex; align-items: center; border-radius: 10px; cursor: pointer; font-size: var(--fs-body); }
.combo-list li.active, .combo-list li:hover { background: var(--tint-soft); color: var(--tint); }
.combo-list li.disabled { color: var(--label-3); cursor: default; background: none; }
.combo-list li.none { color: var(--label-2); cursor: default; background: none; font-size: var(--fs-subhead); }

/* Chips: reaction counts, filters. */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 16px;
  border: 0;
  background: var(--fill);
  color: var(--label);
  font: 400 var(--fs-subhead)/1 var(--font);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  text-decoration: none;
}
.chip.mine { background: var(--tint-soft); color: var(--tint); box-shadow: inset 0 0 0 1.5px var(--tint); font-weight: 600; }
@media (hover: hover) { .chip:hover { background: var(--fill-2); text-decoration: none; } }

/* Pills: small labels such as "Staff" or "You're serving". */
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font: 600 var(--fs-caption)/1.4 var(--font); background: var(--fill); color: var(--label-2); letter-spacing: 0; }
.pill.tint { background: var(--tint-soft); color: var(--tint); }
.pill.green { background: var(--green-soft); color: var(--green); }
.pill.orange { background: var(--orange-soft); color: var(--orange); }
.pill.red { background: var(--red-soft); color: var(--red); }

/* Notices inside a page (saved, errors). */
.notice { border-radius: var(--r-inner); padding: 12px 14px; margin: 0 0 16px; font-size: var(--fs-subhead); line-height: 1.4; background: var(--fill); color: var(--label); }
.notice.ok { background: var(--green-soft); color: var(--green); font-weight: 600; }
.notice.err, .error-box { background: var(--red-soft); color: var(--red); font-weight: 600; border: 0; border-radius: var(--r-inner); padding: 12px 14px; font-size: var(--fs-subhead); }
.notice.warn { background: var(--orange-soft); color: var(--orange); }

/* ---- Empty states (C8) ------------------------------------------------------- */
.empty {
  display: grid;
  justify-items: center;
  gap: 6px;
  text-align: center;
  padding: 40px 24px;
  color: var(--label-2);
}
.empty > .icon { width: 48px; height: 48px; stroke-width: 1.3; color: var(--label-3); margin-bottom: 4px; }
.empty-title { font: 600 var(--fs-title3)/1.25 var(--font); color: var(--label); margin: 0; }
.empty-text { font-size: var(--fs-subhead); line-height: 1.4; margin: 0; max-width: 34ch; }
.empty .btn, .empty button { margin-top: 12px; }
.list .empty { padding: 28px 20px; }

/* ---- Sheets (C4, C5) ---------------------------------------------------------
   <dialog class="sheet"> for compose (Cancel / title / Post), and
   <dialog class="action-sheet"> for "are you sure" choices. ui.js opens them;
   without JavaScript the forms inside are still ordinary pages. */
dialog.sheet, dialog.action-sheet {
  border: 0;
  padding: 0;
  color: var(--label);
  max-width: 640px;
  width: 100%;
  margin: auto auto 0;
}
dialog.sheet {
  background: var(--card);
  border-radius: 22px 22px 0 0;
  max-height: calc(100svh - 24px - var(--safe-t));
  padding-bottom: calc(16px + var(--safe-b));
  overflow: auto;
}
dialog.sheet::backdrop, dialog.action-sheet::backdrop { background: var(--overlay); }
dialog[open].sheet, dialog[open].action-sheet { animation: sheet-up 0.32s cubic-bezier(0.2, 0.9, 0.3, 1); }
@keyframes sheet-up { from { transform: translateY(40%); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-grabber { width: 36px; height: 5px; border-radius: 3px; background: var(--fill-2); margin: 6px auto 0; }
.sheet-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--card);
}
.sheet-head h2 { font: 600 var(--fs-headline)/1.2 var(--font); margin: 0; text-align: center; }
.sheet-head > :last-child { justify-self: end; }
.sheet-body { padding: 8px 16px 0; }
.sheet-body textarea { min-height: 140px; border: 0; background: none; padding: 4px 0; font-size: var(--fs-body); box-shadow: none; }
.sheet-body textarea:focus { box-shadow: none; }

dialog.action-sheet { background: none; padding: 0 8px calc(8px + var(--safe-b)); overflow: visible; }
.as-group { background: var(--glass-solid); border-radius: 16px; overflow: hidden; }
.as-title { margin: 0; padding: 14px 16px; text-align: center; font-size: var(--fs-footnote); line-height: 1.35; color: var(--label-2); }
.as-btn {
  display: block;
  width: 100%;
  min-height: 56px;
  border-radius: 0;
  border: 0;
  border-top: 0.5px solid var(--sep);
  background: none;
  color: var(--tint);
  font: 400 var(--fs-title3)/1.2 var(--font);
}
.as-group > .as-btn:first-child { border-top: 0; }
@media (hover: hover) { .as-btn:hover { background: var(--fill); } }
.as-btn.destructive { color: var(--red); }
.as-cancel { margin-top: 8px; border-radius: 16px; background: var(--glass-solid); font-weight: 600; border: 0; }
@media (min-width: 700px) {
  dialog.sheet { margin: auto; border-radius: 22px; max-height: min(720px, calc(100svh - 80px)); padding-bottom: 16px; }
  dialog.action-sheet { margin: auto; max-width: 340px; }
  @keyframes sheet-up { from { transform: scale(0.96); opacity: 0; } to { transform: none; opacity: 1; } }
}
html:has(dialog[open]) { overflow: hidden; }

/* ---- Menus (C6) -------------------------------------------------------------- */
.menu {
  background: var(--glass);
  -webkit-backdrop-filter: blur(24px) saturate(1.8);
  backdrop-filter: blur(24px) saturate(1.8);
  border: 0.5px solid var(--glass-edge);
  border-radius: 14px;
  box-shadow: var(--float-shadow);
  min-width: 230px;
  overflow: hidden;
  padding: 0;
}
.menu-item, .menu form > button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  min-height: 44px;
  padding: 11px 16px;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--label);
  font: 400 var(--fs-body)/1.2 var(--font);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.menu-item + .menu-item, .menu form + form > button, .menu-item + form > button, .menu form + .menu-item { box-shadow: inset 0 0.5px 0 var(--sep); }
.menu-item .icon, .menu form > button .icon { width: 20px; height: 20px; flex: none; }
@media (hover: hover) { .menu-item:hover, .menu form > button:hover { background: var(--fill); text-decoration: none; } }
.menu-item:active, .menu form > button:active { background: var(--fill-2); }
.menu-item.destructive, .menu form > button.destructive { color: var(--red); }
.menu-sep { height: 8px; background: var(--fill); }

/* ---- Avatars: Contacts-style monograms --------------------------------------- */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(180deg, #a3aab8, #858c9b);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0;
  flex-shrink: 0;
  object-fit: cover;
}
.avatar.avatar-sm { width: 30px; height: 30px; font-size: 0.7rem; }
.avatar.avatar-lg { width: 84px; height: 84px; font-size: 1.9rem; }
.avatar.avatar-md { width: 44px; height: 44px; }

/* Swipe rows (ui.js): the row slides left over its actions. */
.swipe-wrap { position: relative; overflow: hidden; }
.swipe { position: relative; z-index: 1; background: var(--card); transition: transform 0.25s; }
.swipe-actions { position: absolute; top: 0; right: 0; bottom: 0; display: flex; }
.swipe-actions > *, .swipe-actions form > button { height: 100%; min-width: 88px; border-radius: 0; padding: 0 14px; font: 600 var(--fs-subhead)/1.2 var(--font); }
.swipe-actions form { margin: 0; height: 100%; }

/* A person at the top of their page (Profile, People). */
.me-head { display: grid; justify-items: center; text-align: center; gap: 2px; margin: 0 0 22px; }
.me-head .avatar-lg { margin-bottom: 8px; }
.nav-large.me-name { font-size: var(--fs-title2); margin: 0; }
.me-sub { margin: 0; color: var(--label-2); font-size: var(--fs-subhead); }

/* ---- Utility ------------------------------------------------------------------ */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.muted { color: var(--label-2); }
.small { font-size: var(--fs-subhead); }
.footnote { font-size: var(--fs-footnote); color: var(--label-2); line-height: 1.35; }
.stack { display: grid; gap: 12px; }

/* Respect Reduce Motion (P2): no sliding sheets, flashes or bounces. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
