/* The shell (EST-166): the page frame, the rail, the strip, the top bar, the phone's tab bar, and the
   small pieces that sit in them (a count, a source badge, the page title). These were the old system's
   recipes (MiddleLeap Product); they are Estate's own now, rule for rule, under le-sh- names, so no
   screen changed when they moved. They sit in the estate-base layer: any rule in app.css wins over them.
   The Loom design system has a shell of its own (lm-shell, lm-rail, lm-strip, lm-topbar) with a different
   layout (one grid, the content scrolls inside it; the rail becomes the tab bar on a phone). Taking it is
   a separate decision: docs/plans/2026-11-13-loom-design-system-migration.md, section 3, row 4. */
@layer estate-base {
  .le-sh-app { display: flex; align-items: stretch; min-height: 100%; background: var(--surface-ground); color: var(--text-body); font: 400 var(--le-fs-small)/var(--le-lh-ui) var(--font-sans); }
  .le-sh-main { flex: 1 1 auto; min-width: 0; }
  .le-sh-rail { flex: none; box-sizing: border-box; width: 232px; padding: var(--space-4) var(--space-3); background: var(--rail-bg); display: flex; flex-direction: column; gap: var(--space-1); transition: width var(--motion-base) var(--ease-out); }
  .le-sh-rail[data-folded="true"] { width: var(--le-s-8); padding: var(--space-4) calc((var(--le-s-8) - 44px) / 2); }
  .le-sh-rail-top { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); margin-bottom: var(--space-3); }
  .le-sh-rail-logo { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: var(--space-3); height: 44px; padding: 0 var(--space-1); color: var(--rail-text-current); text-decoration: none; overflow: hidden; white-space: nowrap; }
  .le-sh-rail-logo span { font: 400 var(--le-fs-h3)/1 var(--font-sans); color: var(--rail-text-current); }
  .le-sh-rail-heading { padding: var(--space-4) var(--space-3) var(--space-1); font: 400 var(--le-fs-ui-small)/1 var(--font-mono); text-transform: uppercase; letter-spacing: .1em; color: var(--rail-heading); }
  .le-sh-rail-divider { display: none; width: 24px; height: 1px; margin: var(--space-2) auto; background: var(--rail-line); }
  .le-sh-rail-item { position: relative; display: flex; align-items: center; gap: var(--space-3); box-sizing: border-box; width: 100%; height: 44px; padding: 0 var(--space-3); color: var(--rail-text); font: 500 var(--le-fs-small)/1 var(--font-sans); text-decoration: none; white-space: nowrap; overflow: hidden; background: transparent; border: 0; border-radius: var(--radius-inner); cursor: pointer; }
  .le-sh-rail-item svg { width: 20px; height: 20px; flex: none; }
  .le-sh-rail-item:hover, .le-sh-rail-item[aria-current="page"] { background: var(--rail-current-bg); color: var(--rail-text-current); }
  .le-sh-rail-item[aria-current="page"]::before { content: ""; position: absolute; left: 0; top: var(--space-3); width: 3px; height: 20px; background: var(--ember); }
  .le-sh-rail-item .le-sh-count { margin-left: auto; }
  .le-sh-rail-toggle { flex: none; width: 44px; justify-content: center; padding: 0; color: var(--rail-text); border: 1px solid var(--rail-line); }
  .le-sh-rail[data-folded="true"] .le-sh-rail-top { flex-direction: column; gap: var(--space-1); }
  .le-sh-rail[data-folded="true"] .le-sh-rail-label, .le-sh-rail[data-folded="true"] .le-sh-rail-heading, .le-sh-rail[data-folded="true"] .le-sh-rail-logo span { display: none; }
  .le-sh-rail[data-folded="true"] .le-sh-rail-divider { display: block; }
  .le-sh-rail[data-folded="true"] .le-sh-rail-item, .le-sh-rail[data-folded="true"] .le-sh-rail-logo { justify-content: center; padding: 0; overflow: visible; }
  .le-sh-rail[data-folded="true"] .le-sh-count { position: absolute; top: var(--space-1); right: 2px; margin: 0; }
  .le-sh-rail[data-folded="true"] .le-sh-rail-item[data-label]:hover::after, .le-sh-rail[data-folded="true"] .le-sh-rail-item[data-label]:focus-visible::after { content: attr(data-label); position: absolute; left: calc(100% + var(--space-3)); top: 50%; transform: translateY(-50%); z-index: 10; padding: var(--space-1) var(--space-2); background: var(--rail-current-bg); color: var(--rail-text-current); border: 1px solid var(--rail-line); font: 500 var(--le-fs-small-ui)/1.4 var(--font-sans); white-space: nowrap; pointer-events: none; box-shadow: none; }
  .le-sh-tabbar.le-sh-tabbar--auto { display: none; }
  @media (max-width: 900px) {
    .le-sh-rail { width: var(--le-s-8); padding: var(--space-4) calc((var(--le-s-8) - 44px) / 2); }
    .le-sh-rail .le-sh-rail-label, .le-sh-rail .le-sh-rail-heading, .le-sh-rail .le-sh-rail-logo span, .le-sh-rail .le-sh-rail-toggle { display: none; }
    .le-sh-rail .le-sh-rail-divider { display: block; }
    .le-sh-rail .le-sh-rail-top { flex-direction: column; }
    .le-sh-rail .le-sh-rail-item, .le-sh-rail .le-sh-rail-logo { justify-content: center; padding: 0; overflow: visible; }
    .le-sh-rail .le-sh-count { position: absolute; top: var(--space-1); right: 2px; margin: 0; }
    .le-sh-rail .le-sh-rail-item[data-label]:hover::after, .le-sh-rail .le-sh-rail-item[data-label]:focus-visible::after { content: attr(data-label); position: absolute; left: calc(100% + var(--space-3)); top: 50%; transform: translateY(-50%); z-index: 10; padding: var(--space-1) var(--space-2); background: var(--rail-current-bg); color: var(--rail-text-current); border: 1px solid var(--rail-line); font: 500 var(--le-fs-small-ui)/1.4 var(--font-sans); white-space: nowrap; pointer-events: none; box-shadow: none; }
  }
  @media (max-width: 600px) {
    .le-sh-rail { display: none; }
    .le-sh-tabbar.le-sh-tabbar--auto { display: grid; position: sticky; bottom: 0; z-index: 5; }
  }
  .le-sh-count { display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; min-width: 16px; height: 16px; padding: 0 var(--space-1); background: var(--ember); color: var(--on-ember); font: 400 var(--le-fs-ui-small)/1 var(--font-mono); border-radius: var(--radius-pill); }
  .le-sh-env { display: flex; align-items: center; justify-content: center; gap: var(--space-2); padding: var(--space-1) var(--space-4); background: var(--rail-bg); color: var(--rail-text-current); font: 400 var(--le-fs-ui-small)/1.4 var(--font-mono); text-transform: uppercase; letter-spacing: .08em; }
  .le-sh-env::before { content: ""; width: 6px; height: 6px; background: var(--ember); transform: rotate(45deg); }
  .le-sh-topbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-4); min-height: 56px; padding: var(--space-2) var(--space-6); background: var(--surface-ground); border-bottom: 1px solid var(--line-hairline); }
  .le-sh-product { display: flex; align-items: baseline; gap: var(--space-2); }
  .le-sh-product-name { font: 400 var(--le-fs-h3)/1 var(--font-sans); color: var(--text-strong); }
  .le-sh-product-by { font: 400 var(--le-fs-ui)/1 var(--font-sans); color: var(--text-muted); }
  .le-sh-product-by b { font-weight: 600; color: var(--text-strong); }
  .le-sh-wordmark-leap { background: var(--ember); -webkit-background-clip: text; background-clip: text; color: transparent; }
  .le-sh-tabbar { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: var(--space-1) var(--space-1) var(--space-6); background: var(--surface-panel); border-top: 1px solid var(--line-hairline); }
  .le-sh-tabbar a { position: relative; display: flex; flex-direction: column; align-items: center; gap: var(--space-1); min-height: 48px; padding: var(--space-2) 0; color: var(--text-secondary); text-decoration: none; font: 400 var(--le-fs-ui)/1 var(--font-sans); }
  .le-sh-tabbar a svg { width: 22px; height: 22px; }
  .le-sh-tabbar a[aria-current="page"] { color: var(--text-strong); font-weight: 600; }
  .le-sh-tabbar .le-sh-count { position: absolute; top: var(--space-1); left: calc(50% + 6px); }
  label.le-sh-rail-toggle { display: inline-flex; align-items: center; }
  .le-sh-avail { display: inline-flex; align-items: center; gap: var(--space-2); padding: 2px var(--space-2); border: 1px solid transparent; border-radius: var(--radius-pill); font: 400 var(--le-fs-ui-small)/1.4 var(--font-mono); text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; }
  .le-sh-avail::before { content: ""; box-sizing: border-box; width: 8px; height: 8px; flex: none; }
  .le-sh-avail--live { background: var(--positive-dim); color: var(--positive-text); }
  .le-sh-avail--live::before { background: currentColor; }
  .le-sh-avail--mocked { background: transparent; color: var(--text-secondary); border-color: var(--line-control); border-style: dashed; }
  .le-sh-avail--mocked::before { border: 1px solid currentColor; background: repeating-linear-gradient(45deg, currentColor 0 1px, transparent 1px 3px); }
  .le-sh-page { box-sizing: border-box; width: 100%; max-width: 1320px; margin: 0 auto; padding: var(--space-8) var(--space-6) var(--space-12); display: flex; flex-direction: column; gap: var(--space-6); }
  .le-sh-h1 { margin: 0; font: 400 var(--le-fs-h1)/1.1 var(--font-sans); letter-spacing: -.01em; color: var(--text-strong); }
  .le-sh-h1 em { font-style: italic; color: var(--text-strong); }
}
