/* =========================================================
   app.css — the phone shell (UI-1)

   Loads after style.css. It carries the X-on-iOS anatomy:
   tokens, the sticky top bar, the bottom tab bar, the drawer
   and the sign-in front door.

   Everything visual is behind `max-width: 899px`; desktop
   keeps style.css untouched. The only global rules are the
   tokens, the app utilities, and the sign-in page (which owns
   its whole document and has no bars).
   ========================================================= */

:root {
  --app-bg: #000;
  --app-surface: #16181c;
  --app-border: #2f3336;
  --app-text: #e7e9ea;
  --app-muted: #71767b;
  --app-accent: #1d9bf0;
  --app-bar: 53px;
  --app-tab: 64px;
  --app-danger: #f4212e;
  --app-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Bars exist only on the phone. Nothing here leaks to desktop. */
.appbar,
.tabbar,
.appdrawer { display: none; }

/* Utilities the page bodies (UI-2) can lean on. */
.app-title { font-size: 17px; font-weight: 700; line-height: 20px; }
.app-meta { font-size: 13px; line-height: 16px; color: var(--app-muted); }

/* =================== sign in — the front door ========== */
body.authbody {
  margin: 0;
  padding: 24px;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--app-bg);
  background-image: none;
  color: var(--app-text);
  font-family: var(--app-font);
  font-size: 15px;
  line-height: 20px;
  overscroll-behavior-y: contain;
  -webkit-text-size-adjust: 100%;
}

.authapp {
  width: 100%;
  max-width: 360px;
  text-align: center;
}

.authapp__mark {
  display: block;
  width: 56px;
  height: 56px;
  margin: 0 auto;
  border-radius: 50%;
  overflow: hidden;
}

.authapp__mark img {
  display: block;
  width: 56px;
  height: 56px;
  object-fit: cover;
}

.authapp__form { margin: 44px 0 0; }

.authapp__h {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.authapp__field { margin: 0 0 12px; text-align: left; }

.authapp__label {
  display: block;
  margin: 0 0 6px;
  font-size: 13px;
  line-height: 16px;
  color: var(--app-muted);
}

.authapp__input {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 12px 14px;
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: 10px;
  color: var(--app-text);
  font-family: var(--app-font);
  font-size: 16px;
  line-height: 20px;
  -webkit-appearance: none;
  appearance: none;
}

.authapp__input:focus {
  outline: none;
  border-color: var(--app-accent);
}

.authapp__btn {
  display: block;
  width: 100%;
  height: 48px;
  min-height: 48px;
  margin: 20px 0 0;
  padding: 0 16px;
  background: var(--app-accent);
  border: 0;
  border-radius: 999px;
  color: #fff;
  font-family: var(--app-font);
  font-size: 16px;
  font-weight: 700;
  line-height: 48px;
  cursor: pointer;
}

.authapp__btn:active { background: #1a8cd8; }

.authapp__err {
  margin: 12px 0 0;
  font-size: 13px;
  line-height: 16px;
  color: var(--app-danger);
}

/* =================== the phone shell =================== */
@media (max-width: 899px) {

  /* The two new bars replace the legacy header, the burger and the rail. */
  .site-header,
  .nav-burger,
  .nav-toggle,
  .nav-scrim,
  .sidenav,
  .site-nav .nav-extra,
  .site-nav .is-admin { display: none; }

  html,
  body {
    overscroll-behavior-y: contain;
    -webkit-text-size-adjust: 100%;
  }

  body {
    padding-top: calc(var(--app-bar) + env(safe-area-inset-top));
    padding-bottom: calc(var(--app-tab) + env(safe-area-inset-bottom));
    background: var(--app-bg);
    background-image: none;
    color: var(--app-text);
    font-family: var(--app-font);
    font-size: 15px;
    line-height: 20px;
    overflow-x: hidden;
  }

  /* Never let a wide table or a long handle throw the page sideways. */
  img, svg, video, iframe { max-width: 100%; }

  /* A wide table scrolls inside its own box instead of widening the page:
     grid and flex children shrink to the phone and the table keeps its
     own overflow-x (the bench sheet is the case that caught this). */
  .bench,
  .bench > *,
  .bench-sheet,
  .bench-sheet__scroll,
  .site-main > * { min-width: 0; }

  /* iOS zooms the page when a focused control is under 16px. */
  input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]),
  textarea,
  select,
  button {
    font-size: 16px;
    min-height: 44px;
    border-radius: 10px;
  }

  /* Tap feedback instead of hover-only affordances. */
  .post-card:active,
  .portal__card:active,
  .bench__test:active,
  .task:active,
  .mail-item:active,
  .mail-row:active,
  .app-tap:active { background: var(--app-surface); }

  /* ---------------- top bar ---------------- */
  .appbar {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr) 96px;
    align-items: center;
    column-gap: 4px;
    position: sticky;
    top: 0;
    z-index: 60;
    height: calc(var(--app-bar) + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 8px 0;
    background: rgba(0, 0, 0, 0.65);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--app-border);
    box-shadow: none;
    color: var(--app-text);
    font-family: var(--app-font);
  }

  .appbar__lead {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-width: 0;
  }

  .appbar__title {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    max-width: calc(100% - 176px);
    margin: 0;
    padding: 0;
    font-size: 17px;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .appbar__brand {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    max-width: calc(100% - 176px);
    min-width: 0;
    color: var(--app-text);
  }

  .appbar__brand img {
    display: block;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    flex: 0 0 auto;
  }

  .appbar__brand span {
    font-size: 17px;
    font-weight: 700;
    line-height: 20px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .appbar__actions {
    grid-column: 3;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 2px;
    min-width: 0;
  }

  .appbar__icon,
  .appbar__avatar {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
    background: none;
    border: 0;
    border-radius: 999px;
    color: var(--app-text);
    -webkit-tap-highlight-color: transparent;
  }

  .appbar__icon svg,
  .appbar__icon img {
    display: block;
    width: 24px;
    height: 24px;
  }

  .appbar__icon svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .appbar__icon:active,
  .appbar__avatar:active { background: var(--app-surface); }

  .appbar__avatar {
    width: 40px;
    height: 40px;
    min-height: 40px;
    margin-left: 4px;
    overflow: hidden;
    border: 1px solid var(--app-border);
    background: var(--app-surface);
  }

  .appbar__avatar span {
    display: block;
    font-size: 17px;
    font-weight: 700;
    line-height: 1;
    color: var(--app-text);
  }

  /* ---------------- bottom tab bar ---------------- */
  .tabbar {
    display: grid;
    grid-template-columns: 1fr 1fr 76px 1fr 1fr;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    height: calc(var(--app-tab) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--app-bg);
    border-top: 1px solid var(--app-border);
    color: var(--app-muted);
    font-family: var(--app-font);
  }

  .tabbar__tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 2px;
    color: var(--app-muted);
    font-size: 11px;
    line-height: 12px;
    font-weight: 400;
    -webkit-tap-highlight-color: transparent;
  }

  .tabbar__tab svg {
    display: block;
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .tabbar__tab.is-on {
    color: var(--app-text);
    font-weight: 700;
  }

  .tabbar__tab.is-on svg {
    fill: currentColor;
    stroke-width: 2;
  }

  .tabbar__tab:active { background: var(--app-surface); }

  /* Middle slot is the primary control: a 56px accent mic, not a fifth link. */
  .tabbar__mic {
    justify-self: center;
    align-self: center;
    width: 56px;
    min-width: 56px;
    height: 56px;
    min-height: 56px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--app-accent);
    color: #fff;
    display: grid;
    place-items: center;
    -webkit-tap-highlight-color: transparent;
  }

  .tabbar__mic svg {
    display: block;
    width: 28px;
    height: 28px;
    max-width: none;
    fill: currentColor;
    stroke: none;
  }

  .tabbar__sheet {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 16px 16px calc(var(--app-tab) + env(safe-area-inset-bottom) + 12px);
    background: rgba(0, 0, 0, 0.55);
  }

  .tabbar__sheet[hidden] { display: none !important; }

  .tabbar__sheet-card {
    width: min(100%, 360px);
    margin: 0;
    padding: 16px;
    border: 1px solid var(--app-border);
    border-radius: 16px;
    background: var(--app-surface);
    color: var(--app-text);
    font-size: 15px;
    line-height: 20px;
  }

  .tabbar__sheet-card p { margin: 0 0 12px; }

  .tabbar__sheet-card a {
    color: var(--app-accent);
    font-weight: 700;
  }

  .tabbar__sheet-card button {
    display: block;
    width: auto;
    margin-top: 12px;
    padding: 0 14px;
    border: 1px solid var(--app-border);
    border-radius: 999px;
    background: transparent;
    color: var(--app-text);
  }

  .social-empty {
    margin: 0;
    padding: 28px 16px 40px;
  }

  .social-empty h1 {
    margin: 0 0 8px;
    font-family: var(--app-font);
    font-size: 20px;
    font-weight: 700;
    line-height: 24px;
    letter-spacing: 0;
    text-transform: none;
  }

  .social-empty p {
    margin: 0;
    color: var(--app-muted);
    font-size: 15px;
    line-height: 20px;
  }

  /* The partial is included so the shell is present. On the phone the rail
     is a desktop office list (Inbox, Crew). It does not belong on this tab. */
  body:has(#social-h) .office__rail { display: none; }


  /* ---------------- drawer ---------------- */
  .appdrawer {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 80;
    pointer-events: none;
  }

  .appdrawer__scrim {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    opacity: 0;
    transition: opacity 180ms ease;
  }

  .appdrawer__panel {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 280px;
    max-width: 82vw;
    padding: calc(env(safe-area-inset-top) + 8px) 0 calc(env(safe-area-inset-bottom) + 12px);
    background: var(--app-bg);
    border-right: 1px solid var(--app-border);
    transform: translateX(-100%);
    transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    font-family: var(--app-font);
    outline: none;
  }

  .appdrawer.is-open { pointer-events: auto; }
  .appdrawer.is-open .appdrawer__scrim { opacity: 1; }
  .appdrawer.is-open .appdrawer__panel {
    transform: none;
    box-shadow: 0 0 32px rgba(0, 0, 0, 0.6);
  }

  body.app-drawer-open { overflow: hidden; }

  .appdrawer__who {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px 16px;
    border-bottom: 1px solid var(--app-border);
  }

  .appdrawer__who img {
    display: block;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--app-border);
  }

  .appdrawer__who strong {
    display: block;
    font-size: 15px;
    line-height: 20px;
    font-weight: 700;
    color: var(--app-text);
  }

  .appdrawer__who em {
    display: block;
    font-style: normal;
    font-size: 13px;
    line-height: 16px;
    color: var(--app-muted);
  }

  .appdrawer__nav {
    display: flex;
    flex-direction: column;
    padding: 8px 0;
  }

  .appdrawer__row {
    display: flex;
    align-items: center;
    gap: 14px;
    height: 48px;
    min-height: 48px;
    padding: 0 16px;
    background: none;
    border: 0;
    border-radius: 0;
    color: var(--app-text);
    font-family: var(--app-font);
    font-size: 15px;
    line-height: 20px;
    font-weight: 400;
    text-align: left;
    width: 100%;
    -webkit-tap-highlight-color: transparent;
  }

  .appdrawer__row svg {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .appdrawer__row:active { background: var(--app-surface); }

  .appdrawer__divider {
    height: 1px;
    margin: 8px 0;
    background: var(--app-border);
  }

  .appdrawer__form { margin: 0; }

  /* ---- UI-5 feed ----
     The feed is the X-on-iOS home screen on the phone: no shell gutters, no
     owner hero (the appbar brand already names the site on `/`), full-bleed
     cards, 44px every target, and a 10-line clamp so long posts stop eating
     the scroll. Desktop markup and desktop CSS are untouched: every rule
     below lives inside `max-width: 899px`. */

  /* The shell's feed column goes edge to edge. */
  .shell-feed .shell,
  .shell-feed .shell__main,
  .shell-feed .site-main {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    min-width: 0;
  }

  /* The hero block is a first-screen eater at 390px; the appbar carries the
     mark + site name on `/`, so the hero and its duplicate "Feed" kicker go. */
  .shell-feed .hero,
  .shell-feed .feed__head { display: none; }

  .feed { margin: 0; min-width: 0; }
  .feed__list { margin: 0; padding: 0; list-style: none; }

  /* ---------------- compose row ---------------- */
  .feed-compose {
    gap: 10px;
    min-height: 56px;
    padding: 8px 16px;
    background: var(--app-bg);
    border-bottom: 1px solid var(--app-border);
    color: var(--app-text);
    -webkit-tap-highlight-color: transparent;
  }

  .feed-compose:hover { background: var(--app-bg); }
  .feed-compose:active { background: var(--app-surface); }

  .feed-compose__avatar {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--app-border);
    border-radius: 50%;
    background: var(--app-surface);
    object-fit: cover;
  }

  .feed-compose__ph {
    flex: 1 1 auto;
    min-width: 0;
    color: var(--app-muted);
    font-size: 15px;
    line-height: 20px;
  }

  /* The "Post" pill is a span inside the compose link, so it is not its own
     tap target; it only has to look like the X composer button. */
  .feed-compose .btn {
    flex: 0 0 auto;
    height: 36px;
    min-height: 36px;
    padding: 0 16px;
    background: var(--app-accent);
    border: 0;
    border-radius: 999px;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    line-height: 36px;
  }

  /* ---------------- post card ---------------- */
  .post-card,
  .post-card--lead {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
    max-width: 100%;
    padding: 12px 16px;
    background: var(--app-bg);
    border: 0;
    border-bottom: 1px solid var(--app-border);
    border-radius: 0;
  }

  .post-card:hover { background: var(--app-bg); }
  .post-card:active { background: var(--app-surface); }

  .post-card__avatar {
    flex: 0 0 40px;
    align-self: flex-start;
    min-height: 44px;
  }

  .post-card__avatar img {
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--app-border);
    border-radius: 50%;
    background: var(--app-surface);
    object-fit: cover;
  }

  .post-card__body { flex: 1 1 auto; min-width: 0; }
  .post-card__link { display: block; color: inherit; }

  /* header row: 15/700 name, 13px muted handle + date. The Edit control sits
     in the top-right corner, so the meta row reserves room for it. */
  .post-card__meta {
    display: flex;
    align-items: baseline;
    flex-wrap: nowrap;
    gap: 0 4px;
    min-width: 0;
    margin: 0 0 2px;
    color: var(--app-muted);
    font-size: 13px;
    line-height: 16px;
  }

  /* The Edit pill owns the top-right corner of the header row; only the owner
     sees it, so only those cards grow the row to clear it. */
  .post-card:has(.post-card__edit) .post-card__meta {
    align-items: center;
    min-height: 44px;
    padding-right: 54px;
  }

  .post-card__author {
    flex: 0 0 auto;
    max-width: 60%;
    overflow: hidden;
    color: var(--app-text);
    font-size: 15px;
    font-weight: 700;
    line-height: 20px;
    letter-spacing: 0;
    text-transform: none;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .post-card__handle,
  .post-card__when {
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    color: var(--app-muted);
    font-size: 13px;
    line-height: 16px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* The date and the dot never shrink; the handle truncates like X does. */
  .post-card__meta .dot,
  .post-card__when { flex: 0 0 auto; }

  /* On the narrowest phones the date drops under the name instead of the
     handle truncating to three letters. */
  @media (max-width: 413px) {
    .post-card__meta { flex-wrap: wrap; row-gap: 0; }
    .post-card__meta .dot { display: none; }
    .post-card__when { flex: 1 0 100%; }
  }

  .post-card__title,
  .post-card--lead .post-card__title {
    display: -webkit-box;
    overflow: hidden;
    margin: 2px 0 4px;
    color: var(--app-text);
    font-family: var(--app-font);
    font-size: 17px;
    font-weight: 700;
    line-height: 22px;
    letter-spacing: 0;
    text-transform: none;
    overflow-wrap: anywhere;
    word-break: break-word;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
  }

  .post-card__excerpt,
  .post-card--lead .post-card__excerpt {
    display: -webkit-box;
    overflow: hidden;
    max-height: 200px;
    margin: 0 0 8px;
    color: var(--app-text);
    font-size: 15px;
    line-height: 20px;
    overflow-wrap: anywhere;
    word-break: break-word;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 10;
  }

  /* The clamp keeps the native ellipsis for very long posts; the visible
     affordance is part of the card link, so a tap opens the whole post. */
  .post-card__excerpt::after {
    content: " Show more";
    color: var(--app-accent);
    font-weight: 400;
  }

  .post-card__hero,
  .post-card__hero--1,
  .post-card--lead .post-card__hero,
  .post-card--lead .post-card__hero--1 {
    max-height: 300px;
    margin: 10px 0 0;
    border: 1px solid var(--app-border);
    border-radius: 16px;
    background: #0d0b0b;
  }

  .post-card--lead .post-card__hero img { object-position: center; }

  /* A single cover is usually the post own figure, not a photo: contain it so
     a chart never loses its left edge to an aspect-ratio crop. The box keeps a
     fixed ratio because these images are lazy-loaded and a collapsed box would
     jump the feed as they arrive. */
  .post-card__hero--1 img { object-fit: contain; }

  /* ---------------- action row ---------------- */
  .post-card__foot {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0 8px;
    min-width: 0;
    max-width: 100%;
    margin: 2px 0 0;
  }

  /* reply: 44px target, icon + 13px count on one line */
  .post-card__action {
    display: inline-flex;
    flex: 0 0 auto;
    order: 1;
    align-items: center;
    gap: 6px;
    height: 44px;
    min-height: 44px;
    margin: 0 0 0 -8px;
    padding: 0 8px;
    background: transparent;
    border: 0;
    border-radius: 999px;
    color: var(--app-muted);
    font-size: 13px;
    line-height: 1;
    -webkit-tap-highlight-color: transparent;
  }

  .post-card__action span { font-size: 17px; line-height: 1; }
  .post-card__action:hover { background: transparent; color: var(--app-muted); }
  .post-card__action:active { background: var(--app-surface); color: var(--app-text); }

  /* share cluster: its own line of four equal 44px columns. Five labelled
     platforms do not fit beside the reply count, and a sideways scroller cut
     the last pill in half, so the row is spread instead. */
  .post-card__foot .share,
  .post-card__foot .share--compact {
    display: flex;
    flex: 1 1 100%;
    order: 3;
    flex-wrap: wrap;
    align-items: center;
    gap: 0;
    min-width: 0;
    max-width: 100%;
    margin: 0;
    padding: 0;
  }

  .post-card__foot .share__btn {
    display: inline-flex;
    flex: 1 1 0;
    min-width: 56px;
    align-items: center;
    justify-content: center;
    height: 44px;
    min-height: 44px;
    padding: 0 2px;
    background: transparent;
    border: 0;
    border-radius: 999px;
    color: var(--app-muted);
    font-family: var(--app-font);
    font-size: 13px;
    letter-spacing: 0;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  /* share.js un-hides "Send" only when Web Share exists; the phone layer must
     not switch a hidden control back on. */
  .post-card__foot .share__btn[hidden] { display: none; }

  .post-card__foot .share__btn:hover {
    background: transparent;
    border-color: transparent;
    color: var(--app-muted);
  }

  .post-card__foot .share__btn:active {
    background: var(--app-surface);
    border-color: transparent;
    color: var(--app-text);
  }

  /* owner controls: EDIT is a 44px control in the card header, DELETE a 44px
     control at the right of the reply row. */
  .post-card__edit {
    position: absolute;
    top: 6px;
    right: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    min-height: 44px;
    margin: 0;
    padding: 0 9px;
    background: transparent;
    border: 1px solid var(--app-border);
    border-radius: 999px;
    color: var(--app-muted);
    font-family: var(--app-font);
    font-size: 13px;
    font-weight: 400;
    letter-spacing: 0;
    line-height: 1;
    text-transform: none;
    -webkit-tap-highlight-color: transparent;
  }

  .post-card__edit:hover { color: var(--app-muted); border-color: var(--app-border); }
  .post-card__edit:active { background: var(--app-surface); color: var(--app-text); }

  .post-card__del {
    display: inline-flex;
    flex: 0 0 auto;
    order: 2;
    align-items: center;
    justify-content: center;
    height: 44px;
    min-height: 44px;
    margin: 0 0 0 auto;
    padding: 0 8px;
    background: transparent;
    border: 0;
    border-radius: 999px;
    color: var(--app-danger);
    font-family: var(--app-font);
    font-size: 13px;
    font-weight: 400;
    letter-spacing: 0;
    line-height: 1;
    text-transform: none;
    -webkit-tap-highlight-color: transparent;
  }

  .post-card__del:hover { background: transparent; border-color: transparent; color: var(--app-danger); }
  .post-card__del:active { background: var(--app-surface); border-color: transparent; color: var(--app-danger); }

  .feed__empty {
    margin: 0;
    padding: 40px 16px;
    border-bottom: 1px solid var(--app-border);
    color: var(--app-muted);
  }
}

/* ======================================================================
   TOOLS-001 — one grouped rail, one /tools index.
   Rows and groups come from src/services/rail.service.js; this block only
   gives them the /plan rail rhythm (32px rows, 264px column, left-bar on the
   row you are on) wherever a rail renders them.
   ====================================================================== */

.railbox { min-width: 0; }

.railbox .rail-sec {
  padding: 8px 0 12px;
  border-top: 1px solid var(--line);
  min-width: 0;
}
.railbox .rail-sec:first-child { border-top: 0; padding-top: 0; }
.railbox .rail-h {
  margin: 0 0 8px 8px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 400;
}
.railbox .rail-nav { display: grid; min-width: 0; }
.railbox .rail-a {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 4px 8px 4px 10px;
  color: var(--ink-dim);
  border-left: 2px solid transparent;
  line-height: 1.3;
  text-decoration: none;
  min-width: 0;
}
.railbox .rail-a:hover,
.railbox .rail-a:focus-visible { color: var(--ink); background: var(--bg-raised); }
.railbox .rail-a.is-on {
  color: var(--ink);
  background: var(--bg-raised);
  border-left-color: var(--ink);
}
.railbox .rail-a[data-child] { padding-left: 22px; font-size: 0.92em; }
.railbox .rail-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* "All tools" closes the rail on every surface that shows it. */
.rail-more {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.railbox .rail-more .rail-a { color: var(--ink-faint); }
.railbox .rail-more .rail-a:hover { color: var(--ink); }

/* A page that has an office rail gets its groups there, not twice. */
.shell:has(.office__rail) .sidenav .rail-sec,
.shell:has(.office__rail) .sidenav .rail-more { display: none; }

/* Office rail: keep the rail rhythm, keep the office padding. */
body.shell-office .office__rail .rail-a { min-height: 32px; }
body.shell-office .office__rail .rail-more { margin: 10px 0 0; }

/* /plan's own rail already styles .plan-rail__a; the shared classes add nothing
   there, but the "All tools" row needs the row rules when plan.css is the only
   sheet that knows the rail. */

/* ---- the header Tools menu (owner) ---- */
.site-nav .nav-tools { position: relative; margin-left: 22px; }
.site-nav .nav-tools__sum {
  cursor: pointer;
  color: var(--ink-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.78rem;
  padding: 4px 0;
  border-bottom: 1px solid transparent;
  list-style: none;
  display: inline-block;
}
.site-nav .nav-tools__sum::-webkit-details-marker { display: none; }
.site-nav .nav-tools__sum:hover,
.site-nav .nav-tools[open] .nav-tools__sum { color: var(--ink); border-color: var(--ink); }
.nav-tools__panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 60;
  width: min(620px, calc(100vw - 32px));
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 20px;
  padding: 14px 16px;
  background: #141212;
  border: 1px solid var(--line);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
}
.nav-tools__group { display: grid; gap: 1px; align-content: start; min-width: 0; }
.nav-tools__h {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 4px 6px;
}
.site-nav .nav-tools__a {
  margin-left: 0;
  padding: 3px 6px;
  border-bottom: 0;
  border-radius: 6px;
  font-size: 13px;
  letter-spacing: 0.01em;
  text-transform: none;
  color: var(--ink-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.site-nav .nav-tools__a:hover,
.site-nav .nav-tools__a[aria-current] { color: var(--ink); background: rgba(255, 255, 255, 0.06); }
.site-nav .nav-tools__all {
  grid-column: 1 / -1;
  margin-left: 0;
  padding: 10px 6px 2px;
  border-bottom: 0;
  border-top: 1px solid var(--line);
  font-size: 11px;
  letter-spacing: 0.1em;
}

/* ---- /tools: the index ---- */
.tools__group { padding: 14px 0 16px; border-top: 1px solid var(--line); }
.tools__group:first-of-type { border-top: 0; padding-top: 4px; }
.tools__h {
  margin: 0 0 2px;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 400;
}
.tools__note { margin: 0 0 10px; color: var(--ink-dim); font-size: 0.9rem; }
.tools__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.tools__row {
  display: grid;
  grid-template-columns: 150px 190px minmax(0, 1fr);
  gap: 12px;
  align-items: baseline;
  padding: 5px 8px;
  border-left: 2px solid transparent;
  border-radius: 0 6px 6px 0;
}
.tools__row:hover { background: var(--bg-raised); border-left-color: var(--line-strong); }
.tools__row--child { padding-left: 26px; }
.tools__link { color: var(--ink); font-weight: 600; border-bottom: 0; }
.tools__link:hover { border-bottom: 1px solid var(--ink); }
.tools__href { font-family: var(--font-mono); font-size: 12px; color: var(--ink-faint); overflow-wrap: anywhere; }
.tools__desc { color: var(--ink-dim); font-size: 0.9rem; }

@media (max-width: 899px) {
  /* the office rail becomes the chip strip; the groups become its sections */
  body.shell-office .office__rail .rail-sec {
    display: flex;
    align-items: stretch;
    flex: 0 0 auto;
    padding: 0 6px;
    border-top: 0;
    border-left: 1px solid var(--line);
  }
  body.shell-office .office__rail .rail-sec:first-child { border-left: 0; padding-left: 0; }
  body.shell-office .office__rail .rail-h { display: none; }
  body.shell-office .office__rail .rail-nav { display: flex; align-items: stretch; }
  body.shell-office .office__rail .rail-a { min-height: 44px; padding: 0 12px; align-items: center; }
  body.shell-office .office__rail .rail-more {
    display: flex;
    align-items: stretch;
    flex: 0 0 auto;
    margin: 0;
    padding: 0 0 0 6px;
    border-top: 0;
    border-left: 1px solid var(--line);
  }
  .nav-tools { display: none; }
  .tools__row { grid-template-columns: minmax(0, 1fr); gap: 2px; padding: 8px; }
  .tools__row--child { padding-left: 24px; }
}
