/* Partners: one clean sheet, every class `p-`.
 *
 * The look is Requests' (apps/requests/app.css), which is Field's iOS layer
 * taken as final values: the same --f-* tokens and the same SF type scale
 * (renamed --p-*). Three layouts from one tree (CLAUDE.md design brief):
 *
 *   phone   (<768)   one column, cards stacked, upload is a bottom sheet;
 *   iPad    (768+)   a centred 680px column, cards 2x2, the sheet a modal;
 *   desktop (1024+)  a 320px summary pane beside the 2x2 grid in 1080px.
 *
 * Rules that hold everywhere:
 *  - nothing interactive is smaller than 44pt in either dimension;
 *  - safe areas on every edge (env(safe-area-inset-*));
 *  - both themes through the tokens; a FILLED control is --f-fill with white
 *    text (4.6:1), never the bright accent;
 *  - no input under 16px (iOS zooms);
 *  - no inline style attributes anywhere (CSP style-src 'self').
 */

/* ── Tokens (Requests', apps/requests/app.css) ── */
:root {
  --f-bg: #000000;
  --f-card: #1c1c1e;
  --f-card-2: #2c2c2e;
  --f-card-hover: #2c2c2e;
  --f-border: #38383a;
  --f-border-soft: #2c2c2e;
  --f-text: #ffffff;
  --f-muted: #aeaeb2;
  --f-dim: #8e8e93;
  --f-fill: #0f7cb8;
  --f-field: #1c1c1e;
  --f-glass: rgba(30, 30, 32, 0.82);
  --f-glass-edge: rgba(255, 255, 255, 0.10);
  --f-accent: var(--lh-accent, #2aa3e6);
  --f-accent-soft: var(--lh-accent-soft, rgba(42, 163, 230, 0.13));
  --f-warn: var(--lh-warn, #f5c84a);
  --f-radius: 14px;
  --f-radius-lg: 18px;
  --f-tap: 44px;

  --p-red: #ff6961;
  --p-green: #30d158;
  --p-toolbar-h: 56px;
  --p-field: #2c2c2e;
  --p-row: #2c2c2e; /* a row nested in a card: files, the chosen file */
  --p-ring-track: #2c2c2e;
  /* Text on a tinted (accent-soft) button. */
  --p-tint-fg: #4fb6ec;
  --p-tint-bg: #12293a;

  /* Status chips: solid pairs, each 4.5:1 or better (test/format.test.mjs
     reads these lines and checks every pair in both themes). */
  --p-chip-needed-fg: #f5c84a;
  --p-chip-needed-bg: #3a3014;
  --p-chip-review-fg: #64c4f4;
  --p-chip-review-bg: #13324a;
  --p-chip-complete-fg: #4cd471;
  --p-chip-complete-bg: #163a20;
  --p-chip-expired-fg: #ff6961;
  --p-chip-expired-bg: #3a1513;

  /* SF type scale (size/leading weight). */
  --p-font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;
  /* Display face for page titles: the platform's --lh-font-display, chosen to sit
     next to the condensed uppercase wordmark in the Light Hill logo. */
  --p-display: 'Barlow Condensed', 'Arial Narrow', var(--p-font);
  --p-display-title: 500 40px/1.05 var(--p-display);
  --p-display-card: 500 24px/1.1 var(--p-display);
  --p-large-title: 700 34px/41px var(--p-font);
  --p-title1: 700 28px/34px var(--p-font);
  --p-title3: 600 20px/25px var(--p-font);
  --p-headline: 600 17px/22px var(--p-font);
  --p-body: 400 17px/22px var(--p-font);
  --p-subhead: 400 15px/20px var(--p-font);
  --p-footnote: 400 13px/18px var(--p-font);
  --p-caption: 400 12px/16px var(--p-font);

  color-scheme: dark;
}
:root[data-theme='light'] {
  --f-bg: #f2f2f7;
  --f-card: #ffffff;
  --f-card-2: #e9e9eb;
  --f-card-hover: #e5e5ea;
  --f-border: #c6c6c8;
  --f-border-soft: #e5e5ea;
  --f-text: #000000;
  --f-muted: #5e5e63;
  --f-dim: #6e6e73;
  --f-fill: #0f7cb8;
  --f-field: #e3e3e8;
  --f-glass: rgba(249, 249, 251, 0.85);
  --f-glass-edge: rgba(0, 0, 0, 0.08);
  --f-accent: var(--lh-accent, #0f7cb8);
  --f-accent-soft: var(--lh-accent-soft, rgba(15, 124, 184, 0.10));
  --p-red: #d70015;
  --p-green: #1f8a3c;
  --p-field: #ffffff;
  --p-row: #f2f2f7;
  --p-ring-track: #dcdce1;
  --p-tint-fg: #0b6194;
  --p-tint-bg: #e1eff8;

  --p-chip-needed-fg: #7a5000;
  --p-chip-needed-bg: #fbf0d0;
  --p-chip-review-fg: #0b6194;
  --p-chip-review-bg: #e1eff8;
  --p-chip-complete-fg: #146c2e;
  --p-chip-complete-bg: #dff3e4;
  --p-chip-expired-fg: #b3001b;
  --p-chip-expired-bg: #fde3e3;

  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  font: var(--p-body);
  color: var(--f-text);
  background: var(--f-bg);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;
}

button, select, textarea, input { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
a { color: var(--f-accent); -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--f-accent); outline-offset: 2px; }

/* Hidden until /api/me answers, so nobody sees chrome flash before the
   right screen. main.mjs sets .booted. */
body:not(.booted) .p-shell,
body:not(.booted) .p-toolbar { visibility: hidden; }

/* ── Gate ── */
.p-gate {
  position: fixed; inset: 0; z-index: 400;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px;
  padding: calc(24px + env(safe-area-inset-top)) calc(24px + env(safe-area-inset-right))
           calc(24px + env(safe-area-inset-bottom)) calc(24px + env(safe-area-inset-left));
  text-align: center;
  background: var(--f-bg);
}
.p-gate.is-hidden { display: none; }
.p-gate-logo { display: block; width: min(220px, 60vw); height: auto; }
.p-gate-msg { margin: 0; max-width: 32ch; font: var(--p-body); color: var(--f-muted); }

/* ── Buttons and links ── */
.p-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 0 24px;
  font: var(--p-headline);
  color: #fff; background: var(--f-fill);
  border: 0; border-radius: var(--f-radius); cursor: pointer;
  text-decoration: none;
}
.p-btn:active { filter: brightness(0.9); }
.p-btn:disabled { opacity: 0.45; cursor: default; filter: none; }
.p-btn-wide { width: 100%; }
.p-btn-tinted { color: var(--p-tint-fg); background: var(--p-tint-bg); }
.p-link {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--f-tap); min-width: var(--f-tap); padding: 0 12px;
  font: var(--p-headline); font-weight: 500; color: var(--f-accent);
  background: none; border: 0; cursor: pointer; text-decoration: none;
}
.p-link:disabled { opacity: 0.45; cursor: default; }

/* ── Offline banner ── */
.p-offline {
  display: none;
  padding: 8px calc(16px + env(safe-area-inset-right)) 8px calc(16px + env(safe-area-inset-left));
  padding-top: calc(8px + env(safe-area-inset-top));
  font: var(--p-footnote); font-weight: 600; text-align: center;
  color: #000; background: var(--f-warn);
}
body.is-offline .p-offline { display: block; }

/* ── Toolbar: mark + wordmark leading, one 44pt theme button trailing ── */
.p-toolbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 0 auto;
  min-height: calc(env(safe-area-inset-top) + var(--p-toolbar-h));
  padding: env(safe-area-inset-top) calc(16px + env(safe-area-inset-right)) 0 calc(16px + env(safe-area-inset-left));
  background: var(--f-bg);
}
.p-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.p-brand-logo { display: block; height: 30px; width: auto; flex: none; }
.p-brand-name { font: 500 20px/1 var(--p-display); text-transform: uppercase; letter-spacing: 0.1em; white-space: nowrap; padding-top: 2px; }
/* The sign-in card carries its own big mark; one is enough. */
body[data-screen='signin'] .p-brand { visibility: hidden; }

/* One button: a sun on the dark theme (switch to light), a moon on the light
   theme (switch to dark). main.mjs keeps its aria-label in step. */
.p-theme-btn {
  flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; padding: 0;
  color: var(--f-text); background: var(--f-card-2);
  border: 0; border-radius: 50%; cursor: pointer;
}
.p-theme-btn:active { background: var(--f-border); }
.p-theme-btn:focus-visible { outline: 2px solid var(--f-accent); outline-offset: 2px; }
.p-theme-ico {
  display: none; width: 22px; height: 22px;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
:root[data-theme='dark'] .p-theme-sun { display: block; }
:root[data-theme='light'] .p-theme-moon { display: block; }

/* ── Shell ── */
.p-shell {
  margin: 0 auto;
  padding: 0 calc(16px + env(safe-area-inset-right)) calc(32px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left));
}

/* ── Sign in ── */
.p-signin {
  display: flex; align-items: center; justify-content: center;
  min-height: calc(100dvh - env(safe-area-inset-top) - var(--p-toolbar-h) - 32px - env(safe-area-inset-bottom));
  padding: 8px 0 24px;
}
.p-signin-card {
  display: flex; flex-direction: column; align-items: center;
  width: 100%; max-width: 400px;
  text-align: center;
}
.p-signin-logo { display: block; width: min(300px, 78vw); height: auto; margin: 0 auto 22px; }
/* The logo file is the brand's navy on transparent. On the dark theme navy on
   black has no contrast, so it is reversed to white, the standard mono
   treatment; the light theme shows the file as supplied. */
:root[data-theme='dark'] .p-logo, :root[data-theme='dark'] .p-signin-logo { filter: brightness(0) invert(1); opacity: 0.94; }
/* Optical centring (Chris, 2026-10-06). The lantern hangs off the left of the
   logo's box, so the wordmark "LIGHT HILL" sits about 7% of the logo's width to
   the right of the image's geometric centre; and letter-spacing adds a trailing
   gap after the last L that drags the word left. The title is therefore nudged
   right by 4% of the logo's rendered width (Chris dialled it back from 7%) (same min() as .p-signin-logo) plus
   one letter-space, so its glyphs centre under the wordmark, not the image. */
.p-signin-title {
  margin: 0 0 28px; font: var(--p-display-title); text-transform: uppercase;
  letter-spacing: 0.12em; text-wrap: balance;
  padding-left: calc(0.12em + min(12px, 3.12vw));
}
.p-signin-form { display: flex; flex-direction: column; gap: 12px; width: 100%; text-align: left; }
.p-label { font: var(--p-subhead); font-weight: 600; color: var(--f-muted); padding: 0 4px; }
.p-input {
  width: 100%; height: 50px; padding: 0 16px;
  font: var(--p-body); font-size: 17px;
  color: var(--f-text); background: var(--p-field);
  border: 0; border-radius: 12px; outline: none;
}
.p-input:focus { box-shadow: inset 0 0 0 2px var(--f-accent); }
.p-input::placeholder { color: var(--f-dim); }
.p-signin-msg { margin: 0; padding: 0 4px; font: var(--p-subhead); color: var(--f-muted); }
.p-signin-msg.is-error { color: var(--p-red); }
.p-signin-to { margin: 0; padding: 0 4px; font: var(--p-subhead); color: var(--f-muted); overflow-wrap: anywhere; }
.p-signin-links { display: flex; justify-content: space-between; gap: 8px; margin: 0 -12px; }

/* Six drawn cells under ONE transparent input (autofill and paste work). */
.p-code {
  position: relative;
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px;
}
.p-code-cell {
  display: flex; align-items: center; justify-content: center;
  height: 58px;
  font: 600 28px/1 var(--p-font); font-variant-numeric: tabular-nums;
  color: var(--f-text); background: var(--p-field);
  border-radius: 12px;
}
.p-code.is-focused .p-code-cell.is-active { box-shadow: inset 0 0 0 2px var(--f-accent); }
.p-code-input {
  position: absolute; inset: 0; width: 100%; height: 100%;
  padding: 0; margin: 0;
  font-size: 17px; letter-spacing: 1em;
  color: transparent; -webkit-text-fill-color: transparent; caret-color: transparent;
  background: transparent; border: 0; outline: none;
  cursor: text;
}
.p-code-input::selection { background: transparent; }

/* ── Home ── */
.p-summary { padding: 4px 0 8px; }
.p-title { margin: 0; font: var(--p-display-title); text-transform: uppercase; letter-spacing: 0.1em; }
.p-vendor { margin: 2px 0 0; font: var(--p-body); color: var(--f-muted); overflow-wrap: anywhere; }

.p-ring { display: flex; align-items: center; gap: 14px; margin-top: 18px; }
.p-ring-svg { flex: none; width: 56px; height: 56px; }
.p-ring-track { stroke: var(--p-ring-track); }
.p-ring-arc { stroke: var(--f-accent); }
.p-ring.is-done .p-ring-arc { stroke: var(--p-green); }
.p-ring-check { stroke: var(--p-green); }
.p-ring-label { font: var(--p-headline); font-variant-numeric: tabular-nums; }

/* Desktop-only parts of the summary (state, contact, Sign out). */
.p-facts, .p-summary-signout { display: none; }

.p-grid {
  list-style: none; margin: 20px 0 0; padding: 0;
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px;
}

.p-card {
  position: relative;
  display: flex; flex-direction: column; gap: 8px;
  padding: 16px;
  background: var(--f-card);
  border-radius: var(--f-radius-lg);
}
.p-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
/* Card and sheet titles in the display face too (Chris, 2026-10-06), so every
   document name sits in the same condensed uppercase as the logo's wordmark. */
.p-card-title { margin: 0; font: var(--p-display-card); text-transform: uppercase; letter-spacing: 0.06em; min-width: 0; overflow-wrap: anywhere; }
.p-card-hint { margin: 0; font: var(--p-footnote); color: var(--f-muted); }
.p-card-date { margin: 0; font: var(--p-footnote); font-weight: 600; color: var(--f-muted); }
/* Expiry, as the server reports it: "Expires <date>" within 30 days (warn),
   "Expired <date>" once past (red). Both clear 4.5:1 on the card. */
.p-card-expiry { margin: 0; font: var(--p-footnote); font-weight: 600; }
.p-card-expiry.is-soon { color: var(--f-warn); }
.p-card-expiry.is-expired { color: var(--p-red); }
.p-card-foot { display: flex; flex-direction: column; gap: 4px; margin-top: auto; padding-top: 4px; }
.p-card-action { width: 100%; }
.p-template {
  display: inline-flex; align-items: center; align-self: flex-start;
  min-height: var(--f-tap);
  font: var(--p-subhead); font-weight: 600; color: var(--f-accent); text-decoration: none;
}

.p-chip {
  flex: none;
  display: inline-flex; align-items: center; gap: 4px;
  min-height: 26px; padding: 0 10px;
  font: 600 13px/18px var(--p-font); white-space: nowrap;
  border-radius: 999px;
}
.p-chip.is-needed { color: var(--p-chip-needed-fg); background: var(--p-chip-needed-bg); }
.p-chip.is-review { color: var(--p-chip-review-fg); background: var(--p-chip-review-bg); }
.p-chip.is-complete { color: var(--p-chip-complete-fg); background: var(--p-chip-complete-bg); }
.p-chip.is-expired { color: var(--p-chip-expired-fg); background: var(--p-chip-expired-bg); }
.p-chip-ico {
  width: 14px; height: 14px;
  fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round;
}

.p-files { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.p-file {
  display: flex; align-items: center; gap: 10px;
  min-height: 52px; padding: 6px 12px 6px 10px;
  color: var(--f-text); background: var(--p-row);
  border-radius: 12px; text-decoration: none;
}
a.p-file:active { filter: brightness(0.92); }
.p-file-ico, .p-chosen-ico {
  flex: none; width: 24px; height: 24px; color: var(--f-accent);
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.p-file-text, .p-chosen-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.p-file-name, .p-chosen-name {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font: var(--p-subhead); font-weight: 500;
}
.p-file-meta, .p-chosen-size { font: var(--p-caption); color: var(--f-muted); font-variant-numeric: tabular-nums; }

/* Drop target (desktop): a dashed outline and a label over the card. */
.p-drop-hint {
  position: absolute; inset: 0; z-index: 2;
  display: none; align-items: center; justify-content: center;
  font: var(--p-headline); color: var(--f-accent);
  background: var(--f-glass);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  border: 2px dashed var(--f-accent);
  border-radius: inherit;
  pointer-events: none;
}
.p-card.is-over .p-drop-hint,
.p-other.is-over .p-drop-hint { display: flex; }

.p-other { position: relative; margin-top: 28px; border-radius: var(--f-radius-lg); }
.p-section-title {
  margin: 0 0 8px; padding: 0 4px;
  font: var(--p-footnote); font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase;
  color: var(--f-muted);
}
.p-other-body {
  display: flex; flex-direction: column; gap: 4px;
  padding: 12px 12px 4px;
  background: var(--f-card); border-radius: var(--f-radius-lg);
}
.p-other-body .p-files { margin: 0; }
.p-other-none { margin: 0; padding: 8px 4px; font: var(--p-subhead); color: var(--f-muted); }
.p-other-action { align-self: flex-start; margin-left: -8px; padding: 0 8px; }

.p-foot {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  margin-top: 32px; text-align: center;
}
.p-foot-contact { margin: 0; font: var(--p-subhead); color: var(--f-muted); }
.p-mail { color: var(--f-accent); text-decoration: none; }
.p-mail:hover { text-decoration: underline; }

/* ── Upload sheet: a bottom sheet on a phone ── */
.p-sheet {
  position: fixed; inset: auto 0 0 0;
  width: 100%; max-width: none; height: auto;
  max-height: calc(100dvh - env(safe-area-inset-top) - 24px);
  margin: 0; padding: 0;
  color: var(--f-text); background: var(--f-card);
  border: 0; border-radius: var(--f-radius-lg) var(--f-radius-lg) 0 0;
  overflow-y: auto; overscroll-behavior: contain;
  box-shadow: 0 -8px 40px rgb(0 0 0 / 0.25);
}
.p-sheet[open] { animation: p-sheet-up 0.32s cubic-bezier(0.2, 0.8, 0.2, 1); }
.p-sheet::backdrop { background: rgb(0 0 0 / 0.45); animation: p-fade 0.2s ease-out; }
@keyframes p-sheet-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes p-pop { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes p-fade { from { opacity: 0; } to { opacity: 1; } }

.p-sheet-inner {
  display: flex; flex-direction: column; gap: 14px;
  padding: 8px calc(16px + env(safe-area-inset-right)) calc(20px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left));
}
.p-sheet-grabber { width: 36px; height: 5px; margin: 0 auto; border-radius: 3px; background: var(--f-border); }
.p-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.p-sheet-title { margin: 0; font: var(--p-display-card); text-transform: uppercase; letter-spacing: 0.06em; min-width: 0; overflow-wrap: anywhere; }
.p-sheet-cancel { margin-right: -12px; font-weight: 400; }
.p-sheet-body { display: flex; flex-direction: column; gap: 14px; }
.p-sheet-hint { margin: 0; font: var(--p-subhead); color: var(--f-muted); }

.p-drop {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 28px 16px 22px;
  text-align: center;
  border: 2px dashed var(--f-border); border-radius: 16px;
  transition: border-color 0.15s, background-color 0.15s;
}
.p-drop.is-over, .p-sheet.is-dragging .p-drop { border-color: var(--f-accent); background: var(--f-accent-soft); }
.p-drop-ico {
  width: 36px; height: 36px; color: var(--f-accent);
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.p-drop-btn { min-width: 200px; }
.p-drop-drag { margin: 0; font: var(--p-subhead); color: var(--f-muted); }
.p-drop-formats { margin: 0; font: var(--p-footnote); color: var(--f-dim); }
/* No dragging on a touch screen; don't offer it. */
@media (hover: none) { .p-drop-drag { display: none; } }
.p-file-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.p-chosen {
  display: flex; align-items: center; gap: 12px;
  min-height: 60px; padding: 8px 4px 8px 12px;
  background: var(--p-row); border-radius: var(--f-radius);
}
.p-chosen-again { flex: none; font: var(--p-subhead); font-weight: 600; }

.p-sheet-note { margin: 0; font: var(--p-subhead); color: var(--f-muted); }
.p-sheet-note.is-error { color: var(--p-red); }

.p-progress {
  -webkit-appearance: none; appearance: none;
  display: block; width: 100%; height: 6px;
  border: 0; border-radius: 3px; overflow: hidden;
  color: var(--f-accent); background: var(--f-card-2);
}
.p-progress::-webkit-progress-bar { background: var(--f-card-2); border-radius: 3px; }
.p-progress::-webkit-progress-value { background: var(--f-accent); border-radius: 3px; transition: width 0.2s; }
.p-progress::-moz-progress-bar { background: var(--f-accent); border-radius: 3px; }
.p-progress:indeterminate {
  background: linear-gradient(90deg, var(--f-card-2) 0%, var(--f-accent) 50%, var(--f-card-2) 100%) 0 0 / 200% 100%;
  animation: p-sweep 1.2s linear infinite;
}
.p-progress:indeterminate::-webkit-progress-bar { background: transparent; }
.p-progress:indeterminate::-moz-progress-bar { background: transparent; }
@keyframes p-sweep { from { background-position: 100% 0; } to { background-position: -100% 0; } }

.p-sheet-success {
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  padding: 12px 0 4px; text-align: center;
}
.p-success-ico {
  display: inline-flex; align-items: center; justify-content: center;
  width: 60px; height: 60px; border-radius: 50%;
  color: #fff; background: var(--p-green);
}
.p-success-check {
  width: 32px; height: 32px;
  fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round;
}
.p-success-text { margin: 0; max-width: 32ch; font: var(--p-body); }

/* ── Wide screens (iPad and up). Same query string as lib/layout.js
   WIDE_QUERY; test/layout.test.mjs pins it. A centred 680px column, the
   cards 2x2, the sheet a centred modal. ── */
@media (min-width: 768px) and (min-height: 500px) {
  .p-toolbar, .p-shell { max-width: calc(680px + 32px); }

  .p-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .p-sheet {
    inset: 0;
    width: min(520px, calc(100% - 48px));
    max-height: min(760px, calc(100dvh - 48px));
    height: fit-content;
    margin: auto;
    border-radius: var(--f-radius-lg);
    box-shadow: 0 24px 64px rgb(0 0 0 / 0.35);
  }
  .p-sheet[open] { animation: p-pop 0.22s cubic-bezier(0.2, 0.8, 0.2, 1); }
  .p-sheet-grabber { display: none; }
  .p-sheet-inner { padding: 20px 24px 24px; }
}

/* ── Desktop (1024+): two panes inside 1080px. Same query as lib/layout.js
   SPLIT_QUERY. The summary pane on the left holds the vendor's name, state,
   contact, ring and Sign out, so the footer goes. ── */
@media (min-width: 1024px) and (min-height: 500px) {
  .p-toolbar, .p-shell { max-width: calc(1080px + 32px); }

  .p-home {
    display: grid; grid-template-columns: 320px minmax(0, 1fr);
    gap: 32px; align-items: start;
    padding-top: 8px;
  }
  .p-summary {
    position: sticky; top: calc(env(safe-area-inset-top) + var(--p-toolbar-h) + 8px);
    display: flex; flex-direction: column;
    padding: 24px;
    background: var(--f-card); border-radius: var(--f-radius-lg);
  }
  .p-title { font: var(--p-title1); }
  .p-ring { flex-direction: column; align-items: flex-start; gap: 12px; margin-top: 24px; }
  .p-ring-svg { width: 96px; height: 96px; }
  .p-facts {
    display: flex; flex-direction: column;
    margin: 24px 0 0; padding: 0;
    border-top: 1px solid var(--f-border-soft);
  }
  .p-fact { display: flex; flex-direction: column; gap: 2px; padding: 12px 0; border-bottom: 1px solid var(--f-border-soft); }
  .p-fact-key { font: var(--p-footnote); color: var(--f-muted); }
  .p-fact-val { margin: 0; font: var(--p-body); overflow-wrap: anywhere; }
  .p-summary-signout { display: inline-flex; align-self: flex-start; margin: 12px 0 -8px -12px; }

  .p-grid { margin-top: 0; gap: 16px; }
  .p-card { padding: 20px; }
  .p-foot { display: none; }
}

@media (hover: hover) {
  .p-theme-btn:hover { background: var(--f-border); }
  a.p-file:hover { filter: brightness(1.08); }
  :root[data-theme='light'] a.p-file:hover { filter: brightness(0.97); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  .p-sheet[open], .p-sheet::backdrop { animation: none !important; }
}
