/* Pagidot web components: twins of the Flutter widgets in flutter/lib/shell. Values come from tokens.css
   (generated from design/tokens.json); load it first. See .agents/design.md. Shadows mirror
   pdEmbossShadows / pdDebossShadows: Flutter blurRadius r -> CSS blur 2 * (0.577r + 0.5). */

:root {
  --pd-display: var(--pd-font-display), "Iowan Old Style", "Palatino Linotype", serif;
  --pd-ui: var(--pd-font-ui), "Avenir Next", "Segoe UI", sans-serif;
  --pd-ease: cubic-bezier(0.215, 0.61, 0.355, 1); /* Curves.easeOutCubic */

  /* pdEmbossShadows(t) */
  --pd-emboss:
    7px 9px 24px -2px color-mix(in srgb, var(--pd-shadow) 16%, transparent),
    -5px -6px 17px -1px color-mix(in srgb, var(--pd-highlight) 75%, transparent);
  /* pdEmbossShadows(t, pressed: true) */
  --pd-emboss-pressed:
    2px 3px 8px -1px color-mix(in srgb, var(--pd-shadow) 20%, transparent),
    -1px -1px 4.5px color-mix(in srgb, var(--pd-highlight) 35%, transparent);
  /* pdDebossShadows(t) */
  --pd-deboss:
    -4px -4px 12.5px color-mix(in srgb, var(--pd-shadow) 22%, transparent),
    5px 6px 15px color-mix(in srgb, var(--pd-highlight) 70%, transparent);
  /* pdDebossShadows(t, focused: true) */
  --pd-deboss-focused:
    0 0 15px color-mix(in srgb, var(--pd-focus) 28%, transparent),
    -3px -3px 10px color-mix(in srgb, var(--pd-shadow) 22%, transparent),
    3px 4px 10px color-mix(in srgb, var(--pd-highlight) 45%, transparent);

  /* Form fields (web): a light well just below the sheet, a hairline edge, a shallow inner press. */
  --pd-field-fill: color-mix(in srgb, var(--pd-paper) 60%, var(--pd-paper-raised));
  --pd-field-edge: color-mix(in srgb, var(--pd-line) 80%, transparent);
  --pd-field-press:
    inset 1px 2px 4px color-mix(in srgb, var(--pd-shadow) 7%, transparent),
    inset -1px -1px 2px color-mix(in srgb, var(--pd-highlight) 80%, transparent);

  /* fluidPad(context): horizontal clamp(20, 4% width, 48), vertical clamp(16, 4% shortest side, 36) */
  --pd-pad-x: clamp(20px, 4vw, 48px);
  --pd-pad-y: clamp(16px, 4vmin, 36px);
}

/* Dark set (tokens.css): the system's choice unless the page pins light, or pinned dark. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    /* Dark: the same top-left light. Drops run deeper (black on slate needs ~2.8x the alpha), the lift
       is the dim lit-rubber --pd-highlight; a light cobalt pad catches the light ink as its highlight. */
    --pd-emboss:
      7px 9px 24px -2px color-mix(in srgb, var(--pd-shadow) 45%, transparent),
      -5px -6px 17px -1px color-mix(in srgb, var(--pd-highlight) 75%, transparent);
    --pd-emboss-pressed:
      2px 3px 8px -1px color-mix(in srgb, var(--pd-shadow) 56%, transparent),
      -1px -1px 4.5px color-mix(in srgb, var(--pd-highlight) 35%, transparent);
    --pd-deboss:
      -4px -4px 12.5px color-mix(in srgb, var(--pd-shadow) 60%, transparent),
      5px 6px 15px color-mix(in srgb, var(--pd-highlight) 70%, transparent);
    --pd-deboss-focused:
      0 0 15px color-mix(in srgb, var(--pd-focus) 28%, transparent),
      -3px -3px 10px color-mix(in srgb, var(--pd-shadow) 60%, transparent),
      3px 4px 10px color-mix(in srgb, var(--pd-highlight) 45%, transparent);
    --pd-field-fill: var(--pd-field-well);
    --pd-field-press: inset 1px 2px 5px color-mix(in srgb, var(--pd-shadow) 55%, transparent);
  }
  :root:not([data-theme="light"]) .btn-primary { --pd-highlight: var(--pd-ink); }
  /* Placeholder jackets stay deep printed objects, with light type. */
  :root:not([data-theme="light"]) .cover, :root:not([data-theme="light"]) .cover-veil { color: var(--pd-ink); }
  :root:not([data-theme="light"]) .cover-tone-0 { background: linear-gradient(155deg, color-mix(in srgb, var(--pd-accent) 55%, var(--pd-shadow)), color-mix(in srgb, var(--pd-accent) 22%, var(--pd-shadow))); }
  :root:not([data-theme="light"]) .cover-tone-1 { background: linear-gradient(155deg, color-mix(in srgb, var(--pd-focus) 50%, var(--pd-shadow)), color-mix(in srgb, var(--pd-accent) 28%, var(--pd-shadow))); }
  :root:not([data-theme="light"]) .cover-tone-2 { background: linear-gradient(155deg, color-mix(in srgb, var(--pd-brass) 60%, var(--pd-shadow)), color-mix(in srgb, var(--pd-brass) 25%, var(--pd-shadow))); }
  :root:not([data-theme="light"]) .cover-tone-3 { background: linear-gradient(155deg, color-mix(in srgb, var(--pd-paper-raised), var(--pd-accent) 22%), var(--pd-field-well)); }
}
:root[data-theme="dark"] {
  /* Dark: the same top-left light. Drops run deeper (black on slate needs ~2.8x the alpha), the lift
     is the dim lit-rubber --pd-highlight; a light cobalt pad catches the light ink as its highlight. */
  --pd-emboss:
    7px 9px 24px -2px color-mix(in srgb, var(--pd-shadow) 45%, transparent),
    -5px -6px 17px -1px color-mix(in srgb, var(--pd-highlight) 75%, transparent);
  --pd-emboss-pressed:
    2px 3px 8px -1px color-mix(in srgb, var(--pd-shadow) 56%, transparent),
    -1px -1px 4.5px color-mix(in srgb, var(--pd-highlight) 35%, transparent);
  --pd-deboss:
    -4px -4px 12.5px color-mix(in srgb, var(--pd-shadow) 60%, transparent),
    5px 6px 15px color-mix(in srgb, var(--pd-highlight) 70%, transparent);
  --pd-deboss-focused:
    0 0 15px color-mix(in srgb, var(--pd-focus) 28%, transparent),
    -3px -3px 10px color-mix(in srgb, var(--pd-shadow) 60%, transparent),
    3px 4px 10px color-mix(in srgb, var(--pd-highlight) 45%, transparent);
  --pd-field-fill: var(--pd-field-well);
  --pd-field-press: inset 1px 2px 5px color-mix(in srgb, var(--pd-shadow) 55%, transparent);
}
:root[data-theme="dark"] .btn-primary { --pd-highlight: var(--pd-ink); }
/* Placeholder jackets stay deep printed objects, with light type. */
:root[data-theme="dark"] .cover, :root[data-theme="dark"] .cover-veil { color: var(--pd-ink); }
:root[data-theme="dark"] .cover-tone-0 { background: linear-gradient(155deg, color-mix(in srgb, var(--pd-accent) 55%, var(--pd-shadow)), color-mix(in srgb, var(--pd-accent) 22%, var(--pd-shadow))); }
:root[data-theme="dark"] .cover-tone-1 { background: linear-gradient(155deg, color-mix(in srgb, var(--pd-focus) 50%, var(--pd-shadow)), color-mix(in srgb, var(--pd-accent) 28%, var(--pd-shadow))); }
:root[data-theme="dark"] .cover-tone-2 { background: linear-gradient(155deg, color-mix(in srgb, var(--pd-brass) 60%, var(--pd-shadow)), color-mix(in srgb, var(--pd-brass) 25%, var(--pd-shadow))); }
:root[data-theme="dark"] .cover-tone-3 { background: linear-gradient(155deg, color-mix(in srgb, var(--pd-paper-raised), var(--pd-accent) 22%), var(--pd-field-well)); }

*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

/* Atmosphere: stone paper with soft cobalt, taupe and ink washes, fixed like the CustomPaint. */
html {
  min-height: 100%;
  background-color: var(--pd-paper);
  background-image:
    radial-gradient(circle 70vh at 10% 105%, color-mix(in srgb, var(--pd-shadow) 4%, transparent), transparent),
    radial-gradient(circle 55vw at 95% -5%, color-mix(in srgb, var(--pd-brass) 7%, transparent), transparent),
    radial-gradient(circle 50vw at 100% 35%, color-mix(in srgb, var(--pd-focus) 4%, transparent), transparent),
    linear-gradient(135deg, color-mix(in srgb, var(--pd-accent) 7%, transparent), transparent 45%);
  background-attachment: fixed;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--pd-ink);
  font-family: var(--pd-ui);
  font-size: var(--pd-type-body);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

/* TextButton: focus blue, w600 */
a { color: var(--pd-focus); font-weight: 600; text-decoration: none; }

a:hover { text-decoration: underline; }

:focus-visible { outline: 2px solid var(--pd-focus); outline-offset: 3px; }
.skip-link { position: fixed; left: 12px; top: -64px; z-index: 1000; padding: 10px 16px; border-radius: 10px; background: var(--pd-accent); color: var(--pd-accent-ink); font-weight: 600; text-decoration: none; }
.skip-link:focus { top: 12px; }
main:focus { outline: none; }

h1, h2, h3 {
  font-family: var(--pd-display);
  font-weight: 600;
  color: var(--pd-ink);
  margin: 0;
}

/* AuthTitleBlock title (compact under 860px) */
h1 { font-size: var(--pd-type-hero); line-height: 1.02; letter-spacing: -1.2px; }

h2 { font-size: var(--pd-type-section); line-height: 1.2; letter-spacing: -0.4px; }

h3 { font-size: var(--pd-type-bar); line-height: 1.2; }

p { margin: 0; }

.muted { color: var(--pd-ink-muted); }

.error { color: var(--pd-danger); }

/* BrandMark: logo + "Pagidot" in Newsreader. In the bar it is the AppBar title size. */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--pd-display);
  font-size: var(--pd-type-bar);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.4px;
  color: var(--pd-ink);
}

.brand:hover { text-decoration: none; }

/* BrandLogo: the P mark (shared/logo.png) on its own transparent shape, no tile behind it. */
.brand-logo {
  --size: 32px;
  width: var(--size);
  height: var(--size);
  flex: none;
  object-fit: contain;
}

/* ---- Layout helpers */

.stack { display: flex; flex-direction: column; gap: 16px; }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 4px;
}

/* Empty status lines take no room. */
[role="status"]:empty { display: none; }

/* BrassRule */
.brass-rule {
  width: 52px;
  height: 3px;
  border-radius: 2px;
  background: var(--pd-brass);
}

/* ---- SoftPanel = GlassPanel = EmbossedSurface(glass: true) */
/* paperRaised at 55%, highlight border, emboss, backdrop blur. */
.panel {
  --face: color-mix(in srgb, var(--pd-paper-raised) 55%, transparent);
  padding: 32px 28px 28px;
  border: 1px solid color-mix(in srgb, var(--pd-highlight) 45%, transparent);
  border-radius: var(--pd-radius-card);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

/* EmbossedSurface face: rim-lit gradient over --face, emboss shadow. */
.panel, .btn {
  background: linear-gradient(
    to bottom right,
    color-mix(in srgb, var(--face), var(--pd-highlight) 22%) 0%,
    var(--face) 45%,
    color-mix(in srgb, var(--face), var(--pd-shadow) 5%) 100%
  );
  box-shadow: var(--pd-emboss);
}

/* ---- Buttons: LoadingButton (EmbossedSurface pad, AnimatedScale 0.95 press) */

.btn {
  --face: var(--pd-paper-raised);
  --fg: var(--pd-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 160px;
  height: var(--pd-control-height);
  padding: 0 28px;
  border: 0;
  border-radius: var(--pd-radius);
  color: var(--fg);
  font: inherit;
  font-size: var(--pd-type-button);
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition:
    transform var(--pd-motion-press) var(--pd-ease),
    box-shadow var(--pd-motion-press) var(--pd-ease);
}

.btn:active:not(:disabled) { transform: scale(var(--pd-motion-press-scale)); }

.btn:active:not(:disabled), .btn:disabled {
  background: linear-gradient(
    to bottom right,
    color-mix(in srgb, var(--face), var(--pd-highlight) 8%) 0%,
    var(--face) 45%,
    color-mix(in srgb, var(--face), var(--pd-shadow) 8%) 100%
  );
  box-shadow: var(--pd-emboss-pressed);
}

.btn:disabled { cursor: default; }

/* Cobalt primary CTA; disabled is accent at 45%. */
.btn-primary { --face: var(--pd-accent); --fg: var(--pd-accent-ink); }

.btn-primary:disabled { --face: color-mix(in srgb, var(--pd-accent) 45%, transparent); }

/* LoadingButton(primary: false) is the plain .btn face. */
.btn-secondary:disabled { --fg: var(--pd-ink-muted); }

/* TextButton */
.btn-ghost {
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  background: none;
  box-shadow: none;
  color: var(--pd-focus);
  font-size: var(--pd-type-label);
  font-weight: 600;
}

.btn-ghost:active:not(:disabled), .btn-ghost:disabled { background: none; box-shadow: none; }

/* ---- Fields: PdField (label above) + DebossedSurface well */

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.field label {
  padding-left: 4px;
  color: var(--pd-ink-muted);
  font-size: 13px;
  font-weight: 600;
  transition: color var(--pd-motion-settle) ease;
}

.field:focus-within label { color: var(--pd-focus); }

/* A light well pressed just below the sheet: hairline edge, shallow inner press; the edge darkens on
   hover and turns focus blue with a soft halo when typing. */
.field input, .field select, .field textarea {
  width: 100%;
  min-width: 0;
  height: var(--pd-control-height);
  padding: 0 16px;
  border: 1px solid var(--pd-field-edge);
  border-radius: var(--pd-radius);
  background: var(--pd-field-fill);
  box-shadow: var(--pd-field-press);
  color: var(--pd-ink);
  font: inherit;
  font-size: var(--pd-type-button);
  font-weight: 500;
  outline: none;
  transition: border-color var(--pd-motion-settle) ease, box-shadow var(--pd-motion-settle) ease, background-color var(--pd-motion-settle) ease;
}

.field input:hover, .field select:hover, .field textarea:hover { border-color: color-mix(in srgb, var(--pd-ink-muted) 45%, transparent); }

.field textarea {
  height: auto;
  min-height: calc(var(--pd-control-height) * 2);
  padding: 16px;
  line-height: 1.45;
  resize: vertical;
}

.field select {
  appearance: none;
  padding-right: 44px;
  background:
    linear-gradient(45deg, transparent 50%, var(--pd-ink-muted) 50%) right 24px center / 6px 6px no-repeat,
    linear-gradient(-45deg, transparent 50%, var(--pd-ink-muted) 50%) right 18px center / 6px 6px no-repeat,
    var(--pd-field-fill);
}

.field input::placeholder, .field textarea::placeholder {
  color: color-mix(in srgb, var(--pd-ink-muted) 70%, transparent);
  font-weight: 400;
}

.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--pd-focus);
  background-color: var(--pd-paper-raised);
  box-shadow: var(--pd-field-press), 0 0 0 4px color-mix(in srgb, var(--pd-focus) 16%, transparent);
}

.field [aria-invalid="true"] { border-color: var(--pd-danger); }
.field [aria-invalid="true"]:focus { box-shadow: var(--pd-field-press), 0 0 0 4px color-mix(in srgb, var(--pd-danger) 14%, transparent); }

/* ---- Badges: accentSoft pill (the selected / indicator wash) */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--pd-accent-soft);
  color: var(--pd-accent);
  font-family: var(--pd-ui);
  font-size: var(--pd-type-small);
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  vertical-align: middle;
}

/* ---- Lists: ListTile rows split by Hairline */

.list { list-style: none; margin: 0; padding: 0; }

.list > li { padding: 14px 0; border-bottom: 1px solid var(--pd-line); }

.list > li:first-child { padding-top: 0; }

.list > li:last-child { padding-bottom: 0; border-bottom: 0; }

/* ListTile title: Newsreader 20 w600. */
.list > li > strong:first-child, .list > li > div:first-child > strong {
  font-family: var(--pd-display);
  font-size: var(--pd-type-bar);
  font-weight: 600;
  line-height: 1.25;
  margin-right: 8px;
}

/* ---- Tables inside a SoftPanel */

/* The wrap scrolls sideways inside its card only when the table cannot fit. */
.table-wrap { width: 100%; overflow-x: auto; }

table.data { width: 100%; border-collapse: collapse; }

/* The first column carries the name and wraps; the rest stay on one line and size to their content. */
table.data td, table.data th { white-space: nowrap; }
table.data td:first-child { width: 100%; min-width: 12rem; white-space: normal; }

table.data th, table.data td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--pd-line);
  text-align: left;
  vertical-align: middle;
}

table.data th:first-child, table.data td:first-child { padding-left: 0; }

table.data th:last-child, table.data td:last-child { padding-right: 0; }

table.data thead th {
  padding-top: 0;
  color: var(--pd-ink-muted);
  font-size: var(--pd-type-small);
  font-weight: 600;
}

table.data tbody tr:last-child td { border-bottom: 0; }

table.data tfoot th { border-top: 1px solid var(--pd-line); border-bottom: 0; padding-bottom: 0; }

/* Money tables (Earnings): figures right-aligned, long headers wrap. */
table.data.money thead th { white-space: normal; vertical-align: bottom; }
table.data.money :is(td, th):not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
table.data.money td:first-child { min-width: 9rem; }
.table-wrap > .help { margin-top: 16px; }

/* ---- Auth: AuthFrame. Wide = brand pane + raised form column; narrow = centered stack */

.auth-main { min-height: 100vh; }

.auth { display: grid; grid-template-columns: 5fr 4fr; min-height: 100vh; }

/* _AuthSpread left pane: Spacer(2), BrandMark(hero), BrassRule, promise, copy, Spacer(3). */
.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 48px 36px 40px 56px;
}

.auth-brand::before { content: ""; flex: 2; }

.auth-brand::after { content: ""; flex: 3; }

.auth-brand .brand { gap: 14px; font-size: clamp(36px, calc(24px + 2vw), 52px); letter-spacing: -1.4px; }

.auth-brand .brand-logo { --size: clamp(44px, calc(28px + 1.8vw), 56px); }

.auth-brand .brass-rule { margin-top: 18px; }

.auth-promise {
  margin-top: 28px;
  font-family: var(--pd-display);
  font-size: 36px;
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.8px;
}

.auth-copy {
  max-width: 300px;
  margin-top: 16px;
  color: var(--pd-ink-muted);
  font-size: var(--pd-type-body);
  font-weight: 500;
  line-height: 1.5;
}

/* Right pane: solid paperRaised column, form optically centered. */
.auth-pane {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 40px clamp(28px, 4.45vw, 52px);
  background: var(--pd-paper-raised);
}

.auth-column { display: flex; flex-direction: column; gap: 30px; }

.auth-stack-brand { display: none; }

/* AuthTitleBlock: title, subtitle, quiet cobalt audience line. */
.title-block { display: flex; flex-direction: column; }

.title-block .subtitle {
  margin-top: 12px;
  color: var(--pd-ink-muted);
  font-size: var(--pd-type-body);
  font-weight: 500;
  line-height: 1.45;
}

.role-switch {
  display: flex;
  margin-top: 18px;
  padding: 5px;
  border-radius: 999px;
  background: var(--pd-paper);
  box-shadow: var(--pd-deboss);
}
.role-switch a,
.role-switch button {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 999px;
  color: var(--pd-ink-muted);
  border: 0;
  background: none;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: color 160ms var(--pd-ease), background 160ms var(--pd-ease), box-shadow 160ms var(--pd-ease);
}
.role-switch a:hover,
.role-switch button:hover { color: var(--pd-ink); }
.role-switch a[aria-current="page"],
.role-switch button[aria-selected="true"] { background: var(--pd-paper-raised); color: var(--pd-ink); box-shadow: var(--pd-emboss); }
.role-switch a:focus-visible,
.role-switch button:focus-visible { outline: 2px solid var(--pd-accent); outline-offset: 2px; }

.title-block .audience {
  margin-top: 16px;
  color: var(--pd-accent);
  font-size: var(--pd-type-small);
  font-weight: 600;
  line-height: 1.4;
}

.auth-form { display: flex; flex-direction: column; gap: 14px; }

.auth-form .actions { flex-direction: column; gap: 12px; margin-top: 8px; }

.auth-form .btn { width: 100%; }

.auth-forgot { align-self: flex-end; font-size: var(--pd-type-label); }
.auth-other { margin-top: 18px; text-align: center; }
.link-button.auth-forgot { display: block; width: fit-content; margin-left: auto; font-weight: 500; text-decoration: none; }
.link-button.auth-forgot:hover { text-decoration: underline; }
/* pagidot.com/delete: what deleting does, one line each. */
.delete-points { margin: 0; padding-left: 20px; display: grid; gap: 8px; line-height: 1.5; }

.auth-form .auth-forgot:last-child { align-self: center; }

.auth-google { display: flex; justify-content: center; margin-top: 16px; min-height: 44px; }
.auth-google:empty { display: none; }
.btn-social .social-mark { width: 20px; height: 20px; flex: none; }
.auth-legal { margin-top: 24px; text-align: center; color: var(--pd-ink-muted); font-size: var(--pd-type-label); }

/* Short windows: AuthFrame's `short` (< 720 tall) tightens the spread. */
@media (max-height: 719px) and (min-width: 860px) {
  .auth-brand { padding: 32px 36px 40px 40px; }

  .auth-promise { margin-top: 18px; font-size: 28px; }

  .auth-copy { display: none; }

  .auth-pane { padding-block: 28px; }

  .auth-column { gap: 22px; }

  .auth h1 { font-size: var(--pd-type-hero-compact); }
}

/* _AuthStack (< 860 wide): flat paper, logo above wordmark, compact title, vertically centered. */
@media (max-width: 859px) {
  .auth {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 32px 28px 40px;
    background: var(--pd-paper);
  }

  .auth-brand { display: none; }

  .auth-pane { padding: 0; background: none; }

  .auth-column { gap: 0; }

  .auth-stack-brand {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 36px;
    font-family: var(--pd-display);
    font-size: 34px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: -1.1px;
  }

  .auth-stack-brand .brand-logo { --size: 52px; }

  .auth-form { margin-top: 30px; }

  h1 { font-size: var(--pd-type-hero-compact); }

  .title-block .subtitle { margin-top: 10px; font-size: var(--pd-type-label); }

  .title-block .audience { margin-top: 14px; font-size: 12px; }

  .panel { padding: 24px 20px 20px; }

}

@media (max-width: 859px) and (max-height: 679px) {
  .auth-stack-brand { gap: 14px; font-size: 28px; }

  .auth-stack-brand .brand-logo { --size: 44px; }
}

/* ---- Desk bits (desk.pagidot.com CSP blocks inline styles, so state lives in classes) */

.desk-wrap { overflow-wrap: anywhere; }

/* Case thread: a reply (the opener sees it) is raised, an internal note pressed in, an escalation warm. */
.thread { display: flex; flex-direction: column; gap: 12px; margin: 0; padding: 0; list-style: none; }
.msg { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border-radius: 16px; }
.msg p { margin: 0; }
.msg .prose { color: var(--pd-ink); }
.msg-reply { background: var(--pd-paper-raised); box-shadow: var(--pd-emboss); }
.msg-note { background: var(--pd-field-well); box-shadow: var(--pd-deboss); }
.msg-message, .msg-you { background: color-mix(in srgb, var(--pd-accent) 7%, var(--pd-paper-raised)); box-shadow: var(--pd-emboss); }
.msg-escalate { background: color-mix(in srgb, var(--pd-warn) 8%, var(--pd-paper)); box-shadow: var(--pd-deboss); }
.msg-meta { color: var(--pd-ink-muted); font-size: var(--pd-type-small); }

.desk-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge-warn { background: color-mix(in srgb, var(--pd-warn) 12%, var(--pd-paper)); color: var(--pd-warn); }
.badge-bad { background: color-mix(in srgb, var(--pd-danger) 10%, var(--pd-paper)); color: var(--pd-danger); }
.badge-quiet { background: var(--pd-field-well); color: var(--pd-ink-muted); }
body.desk { --pd-sticky-top: 84px; }
body.desk .panel { padding: clamp(18px, 2.4vw, 28px); }
body.desk h1 { overflow-wrap: anywhere; }

/* ---- Fluid page system (desk and publisher site). See .agents/design.md "Fluid layout".
   The page uses the width up to --pd-page-max with clamp gutters. The page is a size container, so
   records split into main + side by the room the page really has (the publisher sidebar included), not
   by the viewport. Card lists reflow by auto-fill (.book-grid); desk records are tables that become cards. */

:root {
  --pd-page-max: 1440px;
  --pd-gutter: clamp(16px, 4vw, 48px);
  --pd-gap: clamp(16px, 2vw, 28px);
}

/* Main + side. Narrow: one column in source order (put the side first when it should lead). */
.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--pd-gap);
  align-items: start;
}
.split > * { min-width: 0; }

@container page (min-width: 880px) {
  .split { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
  .split > .split-main { grid-column: 1; grid-row: 1; }
  .split > .split-side { grid-column: 2; grid-row: 1; }
  .split-sticky {
    position: sticky;
    top: var(--pd-sticky-top, 24px);
    max-height: calc(100vh - var(--pd-sticky-top, 24px) - 16px);
    overflow-y: auto;
  }
}

/* Facts: label over value, as many columns as fit. */
.facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr));
  gap: 16px 24px;
  margin: 0;
}
.facts > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.facts dt { color: var(--pd-ink-muted); font-size: var(--pd-type-small); font-weight: 600; }
.facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.split-side .facts { grid-template-columns: minmax(0, 1fr); }
.facts-plain dt { color: var(--pd-ink); font-size: var(--pd-type-label); }
.facts-plain dd { color: var(--pd-ink-muted); font-size: var(--pd-type-label); font-weight: 500; }

/* Toolbar over a list: filters left, a count or search right; wraps on narrow. */
.toolbar > .field { flex: 1 1 280px; }

/* ---- Cookie banner: floating snackbar shape on a glass plate */

.cookie-banner {
  position: fixed;
  left: 20px;
  right: 20px;
  bottom: 20px;
  z-index: 40;
  max-width: var(--pd-content-max);
  margin-inline: auto;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cookie-banner p { color: var(--pd-ink-muted); font-size: var(--pd-type-label); line-height: 1.45; }

/* Accept and Reject: same style, same size, side by side (neither is the default). */
.cookie-banner .actions { justify-content: flex-end; margin: 0; }
.cookie-banner .actions .btn { min-width: 112px; }

/* ---- Legal page */

/* LegalScreen: 640 column. */
.legal-page {
  width: min(calc(100% - 2 * var(--pd-pad-x)), calc(var(--pd-content-list) - 80px));
  margin: var(--pd-pad-y) auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.legal-page .eyebrow a { font-family: var(--pd-display); font-size: var(--pd-type-bar); color: var(--pd-ink); }

.legal-version { font-size: var(--pd-type-label); margin-top: -8px; }

.legal-body { display: flex; flex-direction: column; gap: 10px; line-height: 1.55; color: var(--pd-ink); }
.legal-body h2 { margin-top: 14px; font-family: var(--pd-display); font-size: var(--pd-type-bar); font-weight: 600; }
.legal-body ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }

/* A company fact the owner has not filled in yet ([CAPITALS IN BRACKETS], legal/legal.json). */
mark.placeholder { background: color-mix(in srgb, var(--pd-warn) 26%, transparent); color: var(--pd-ink); font-weight: 700; padding: 0 2px; border-radius: 3px; }

/* Accept-again panel (publisher site): one unticked box per updated document. */
.accept-again { width: min(100%, 560px); margin: 24px auto; padding: 24px; }
.accept-again h1 { font-family: var(--pd-display); font-size: 28px; }
.check-row { display: flex; align-items: flex-start; gap: 10px; font-size: var(--pd-type-label); line-height: 1.45; }
.check-row input { width: 20px; height: 20px; margin: 0; flex: none; accent-color: var(--pd-accent); }

/* ---- PdField prefix icon and password eye (auth fields) */
.field-icon { position: relative; }

.field-icon > input { padding-left: 52px; }

.field-icon > input[type="password"], .field-icon > input[data-was-password] { padding-right: 52px; }

.field-icon svg {
  width: 22px;
  height: 22px;
  fill: var(--pd-ink-muted);
  transition: fill var(--pd-motion-settle) ease;
}

.field-icon .lead {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

.field-icon:focus-within .lead { fill: var(--pd-focus); }

.field-icon .reveal {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
}

/* ---- Publisher app: a working tool, so denser controls (44px buttons, 48px fields), one raised sheet
   per task, debossed wells for input and drop areas, cobalt only for action and state. */

.boot { padding: var(--pd-pad-y) var(--pd-pad-x); }
a.btn:hover { text-decoration: none; }

.btn svg, .icon-btn svg, .side-nav svg, .side-out svg {
  width: 20px;
  height: 20px;
  flex: none;
  fill: currentColor;
}

.app .btn {
  min-width: 0;
  height: 44px;
  padding: 0 22px;
  gap: 8px;
  border-radius: 14px;
  font-size: var(--pd-type-label);
}

.app .btn-sm { height: 38px; padding: 0 16px; border-radius: 12px; }

.app .field input, .app .field select, .app .field textarea {
  height: 48px;
  border-radius: 14px;
  font-size: var(--pd-type-body);
}

.app .field textarea { height: auto; }

.app .field label { padding: 0; color: var(--pd-ink); font-size: var(--pd-type-label); }

.help,
.count,
.note,
.page-head p,
.sheet-head p,
.empty p,
.step-intro,
.check-text p,
.summary dt,
.flag p,
.toc-kind,
.side-who,
.chip-size,
.drop-note {
  color: var(--pd-ink-muted);
}

.help,
.count,
.toc-kind,
.side-who,
.chip-size,
.drop-note,
.book-card .state,
.book-price {
  font-size: var(--pd-type-small);
}

.note, .up-line, .sheet-head p, .check-text p, .checklist a, .drop-formats { font-size: var(--pd-type-label); }

.field .help { margin-top: -4px; }
.note.error, .up-line.error, .bad .check-text p { color: var(--pd-danger); }
.warn { color: var(--pd-warn); }
.price-preview { display: grid; gap: 2px; margin: 0; }
.price-preview strong { color: var(--pd-ink); font-weight: 600; }

/* ---- Shell: sidebar, drawer under 960px */

.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }

.app-bar, .app .drawer-close, .scrim { display: none; }

.sidebar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 22px 14px 18px;
  overflow-y: auto;
  border-right: 1px solid var(--pd-line);
  background: color-mix(in srgb, var(--pd-paper-raised) 80%, transparent);
}

.side-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px 10px;
}

.side-nav { flex: 1; }

.side-group {
  margin: 22px 0 6px;
  padding: 0 14px;
  color: var(--pd-brass);
  font-size: var(--pd-type-small);
  font-weight: 600;
}

.side-nav a, .side-out {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 42px;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  background: none;
  color: var(--pd-ink-muted);
  font: inherit;
  font-size: var(--pd-type-label);
  font-weight: 600;
  cursor: pointer;
}

.side-nav a:hover, .side-out:hover { color: var(--pd-ink); text-decoration: none; }

/* NavigationBar indicator */
.side-nav a[aria-current="page"] { background: var(--pd-accent-soft); color: var(--pd-accent); }

.side-foot { padding-top: 12px; border-top: 1px solid var(--pd-line); }

/* Theme (shell.ts): System / Light / Dark, a raised pill with the chosen one pressed into an accentSoft well. */
.theme-seg { display: flex; gap: 4px; width: max-content; margin: 0 10px 10px; padding: 4px; border-radius: 999px; background: var(--pd-paper-raised); box-shadow: var(--pd-emboss-pressed); }
.theme-seg button { display: grid; place-items: center; width: 38px; height: 32px; border: 0; border-radius: 999px; background: none; color: var(--pd-ink-muted); cursor: pointer; }
.theme-seg button:hover { color: var(--pd-ink); }
.theme-seg button[aria-pressed="true"] { background: var(--pd-accent-soft); box-shadow: var(--pd-deboss); color: var(--pd-accent); }
.theme-seg svg { width: 18px; height: 18px; fill: currentColor; }
.rail-mode .theme-seg { flex-direction: column; margin: 0 auto 10px; }

.side-who { padding: 4px 14px 6px; overflow-wrap: anywhere; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--pd-ink);
  cursor: pointer;
}

.icon-btn:hover { background: var(--pd-accent-soft); }

.side-nav a:focus-visible,
.side-out:focus-visible,
.filters button:focus-visible,
.tabs a:focus-visible {
  outline-offset: -3px;
}

.app-main {
  width: 100%;
  max-width: calc(var(--pd-page-max) + 2 * var(--pd-gutter));
  padding: calc(var(--pd-pad-y) + 8px) var(--pd-gutter) 72px;
  outline: none;
  container: page / inline-size;
}

/* ---- Page frame: crumbs, head, sheets */

.page,
.stack,
.library,
.preview,
.uploader,
.sheet,
.sheet-body,
.step-body,
.book-head-text,
.page-head-text,
.sheet-head {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.page { gap: 24px; }
.page-narrow { max-width: var(--pd-content-list); }
.library, .preview, .uploader { gap: 14px; }
.book-head-text, .page-head-text, .sheet-head { gap: 6px; } .page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 24px;
}

.page-head-text { max-width: 60ch; }

.page-head h1, .book-head h1 {
  font-size: var(--pd-type-title);
  letter-spacing: -0.8px;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

/* Lists without bullets */
.crumbs ol, .book-grid, .side-nav ul, .checklist, .steps, .toc, .offers { margin: 0; padding: 0; list-style: none; }

.crumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: -8px;
  color: var(--pd-ink-muted);
  font-size: var(--pd-type-small);
}

.crumbs li + li::before { content: "/"; padding-right: 6px; color: var(--pd-line); }

.crumbs span[aria-current] { color: var(--pd-ink); font-weight: 600; }

.flash {
  align-self: flex-start;
  padding: 8px 14px;
  border-radius: 10px;
  background: var(--pd-accent-soft);
  color: var(--pd-accent);
  font-size: var(--pd-type-label);
  font-weight: 600;
}

.sheet,
.reader-page {
  padding: 26px 28px;
  border-radius: var(--pd-radius-card);
  background: var(--pd-paper-raised);
  box-shadow: var(--pd-emboss);
}

.sheet-head h2 { font-size: var(--pd-type-bar); }

.sheet-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 12px 16px;
  padding-top: 20px;
  border-top: 1px solid var(--pd-line);
}

.sheet-foot .note { margin-right: auto; }
.sheet .actions { margin: 0; }

.row { display: flex; flex-wrap: wrap; gap: 20px; }

.row > .field { flex: 1 1 200px; }
.app .field input[type="number"] { max-width: 220px; }
.app .row .field input { max-width: 100%; }

/* A titled group of fields inside a sheet */
.group {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 0;
  padding: 20px 0 0;
  border: 0;
  border-top: 1px solid var(--pd-line);
}

.group legend {
  float: left;
  font-family: var(--pd-display);
  font-size: var(--pd-type-bar);
  font-weight: 600;
}

.group legend + .help { margin-top: -10px; }

/* Ruled rows: checklist, offers, key-value summaries */
.checklist > li + li, .offers > li + li, .summary > div + div {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--pd-line);
}

.loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--pd-ink-muted);
}

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  flex: none;
  vertical-align: -3px;
  border: 2px solid color-mix(in srgb, currentColor 25%, transparent);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: pd-spin 0.8s linear infinite;
}

@keyframes pd-spin {
  to { transform: rotate(360deg); }
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 64px 24px;
  text-align: center;
}

.empty p { max-width: 46ch; }

/* Status line: a dot and a few words */
.state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--pd-ink-muted);
  font-size: var(--pd-type-label);
  font-weight: 600;
}

.dot {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: currentColor;
}

.state-live { color: var(--pd-accent); }
.state-quiet .dot { background: none; box-shadow: inset 0 0 0 1.5px currentColor; }
.state-busy .dot { background: var(--pd-brass); }
.state-bad { color: var(--pd-danger); }
.state-warn { color: var(--pd-warn); }

/* ---- Books library */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
}

.toolbar .search { flex: 0 1 300px; }

/* Filters: a debossed track, the chosen one an embossed thumb */
.filters {
  display: flex;
  gap: 2px;
  max-width: 100%;
  padding: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  border-radius: 14px;
  background: var(--pd-field-well);
  box-shadow: var(--pd-deboss);
}

.filters button {
  flex: none;
  height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--pd-ink-muted);
  font: inherit;
  font-size: var(--pd-type-label);
  font-weight: 600;
  cursor: pointer;
}

.filters button:hover { color: var(--pd-ink); }

.filters button[aria-pressed="true"] {
  background: var(--pd-paper-raised);
  box-shadow: var(--pd-emboss-pressed);
  color: var(--pd-accent);
}

/* Books with imprints folded in: the imprint row, then the chosen imprint's name, Rename and the view */
.imprint-row { width: fit-content; margin-bottom: 14px; }
.filters .chip-add { color: var(--pd-accent); }
.filters .chip-add svg { width: 16px; height: 16px; margin-right: 4px; vertical-align: -3px; fill: currentColor; }
.imprint-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-bottom: 18px; }
.imprint-name { flex: 1 1 260px; min-width: 0; }
.imprint-name h2 { margin: 0; overflow-wrap: anywhere; }
.imprint-name p { margin: 2px 0 0; }

.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(156px, 1fr));
  gap: 36px 28px;
  margin-top: 8px;
}

.book-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--pd-ink);
}

.book-card:hover { text-decoration: none; }

.book-card .cover { margin-bottom: 8px; transition: transform var(--pd-motion-settle) var(--pd-ease); }

.book-card:hover .cover { transform: translateY(-3px); }

.book-author { color: var(--pd-ink-muted); font-size: var(--pd-type-label); overflow-wrap: anywhere; }

.book-title {
  font-family: var(--pd-display);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

/* Cover: a 2:3 jacket; without an image, initials on a token gradient */
.cover {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 100%;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  padding: 14% 12%;
  border-radius: 6px;
  background: var(--pd-field-well);
  box-shadow: var(--pd-emboss);
  color: var(--pd-accent-ink);
  container-type: inline-size;
}

/* Spine shade */
.cover::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 7%;
  background: linear-gradient(to right, color-mix(in srgb, var(--pd-shadow) 22%, transparent), transparent);
}

.cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cover-tone-0 { background: linear-gradient(155deg, var(--pd-accent), color-mix(in srgb, var(--pd-accent), var(--pd-shadow) 55%)); }
.cover-tone-1 { background: linear-gradient(155deg, var(--pd-focus), color-mix(in srgb, var(--pd-accent), var(--pd-shadow) 30%)); }
.cover-tone-2 { background: linear-gradient(155deg, var(--pd-brass), color-mix(in srgb, var(--pd-brass), var(--pd-shadow) 60%)); }
.cover-tone-3 { background: linear-gradient(155deg, color-mix(in srgb, var(--pd-ink), var(--pd-accent) 30%), var(--pd-ink)); }

.cover-initials {
  font-family: var(--pd-display);
  font-size: clamp(22px, 22cqi, 64px);
  font-weight: 600;
  line-height: 1;
}

.cover-title {
  display: -webkit-box;
  padding-top: 10px;
  overflow: hidden;
  border-top: 2px solid color-mix(in srgb, var(--pd-accent-ink) 55%, transparent);
  font-family: var(--pd-display);
  font-size: clamp(11px, 9cqi, 16px);
  font-weight: 600;
  line-height: 1.2;
  overflow-wrap: anywhere;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.cover-sm, .cover-lg { width: 72px; flex: none; padding: 12px 10px; } /* % padding follows the parent, not the jacket */
.cover-sm .cover-title { display: none; }
.cover-lg { width: 150px; }

.cover-veil {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: color-mix(in srgb, var(--pd-shadow) 62%, transparent);
  font-family: var(--pd-ui);
  font-size: var(--pd-type-small);
  font-weight: 700;
}

/* ---- One book */

.book-head { display: flex; align-items: center; gap: 20px; }

.book-sub {
  color: var(--pd-ink-muted);
  font-family: var(--pd-display);
  font-size: var(--pd-type-bar);
  line-height: 1.25;
}

/* Tabs: a quiet row over a rule; the current tab carries a cobalt underline */
.tabs {
  display: flex;
  gap: 4px;
  margin-top: -4px;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--pd-line);
}

.tabs a {
  flex: none;
  padding: 12px 12px 11px;
  border-bottom: 2px solid transparent;
  color: var(--pd-ink-muted);
  font-size: var(--pd-type-label);
  font-weight: 600;
}

.tabs a:hover { color: var(--pd-ink); text-decoration: none; }
.tabs a[aria-current="page"] { border-bottom-color: var(--pd-accent); color: var(--pd-ink); }

.tab-body { min-width: 0; }

/* Single-task tabs keep a readable column; the others split into main + side. */
.tab-publish { max-width: calc(var(--pd-content-list) + 80px); }
.tab-contents { max-width: 1080px; }

/* Book side: the jacket, its state, and the next things to do. */
.book-side .cover { width: min(100%, 200px); }
/* One column: the header above already shows the jacket and state, so the side is just the actions. */
@container page (max-width: 879px) {
  .book-side > .cover, .book-side > .state, .book-side > .book-price { display: none; }
}
.quick { display: flex; flex-direction: column; gap: 8px; }
.quick .btn { justify-content: flex-start; width: 100%; }
.store-card { display: flex; gap: 16px; align-items: flex-start; }
.store-card .book-head-text { gap: 4px; }
.store-card .book-title { font-size: var(--pd-type-bar); }
.store-blurb {
  display: -webkit-box;
  overflow: hidden;
  color: var(--pd-ink-muted);
  font-size: var(--pd-type-label);
  white-space: pre-line;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
}
.big-figure { font-family: var(--pd-display); font-size: var(--pd-type-title); font-weight: 600; line-height: 1.1; }

/* Ready-to-publish checklist */
.checklist li {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: start;
  gap: 14px;
}

.tick, .step-num {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: none;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1.5px var(--pd-line);
}

.bad .tick { box-shadow: inset 0 0 0 1.5px var(--pd-danger); }

.done .tick, .current .step-num { background: var(--pd-accent); box-shadow: none; color: var(--pd-accent-ink); }

.tick svg, .step-num svg { width: 16px; height: 16px; fill: currentColor; }

.check-text strong { font-weight: 600; }
.checklist a { white-space: nowrap; }

.prose { max-width: 68ch; white-space: pre-line; }

/* Hold / ban notice */
.flag {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 16px 18px;
  border-left: 3px solid currentColor;
  border-radius: 0 12px 12px 0;
}

.flag-warn { color: var(--pd-warn); background: color-mix(in srgb, var(--pd-warn) 7%, transparent); }
.flag-bad { color: var(--pd-danger); background: color-mix(in srgb, var(--pd-danger) 6%, transparent); }

/* Files: manuscript and cover side by side when there is room */
.files {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
  gap: 24px;
  align-items: start;
}

.cover-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 24px;
}

.cover-row .uploader { flex: 1 1 220px; }

.summary { margin: 0; }

.summary div { display: flex; justify-content: space-between; gap: 16px; }

.summary dd { margin: 0; font-weight: 600; text-align: right; }

/* ---- Upload: debossed drop well, embossed file chip, progress track */

.drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 28px 20px;
  border: 1.5px dashed color-mix(in srgb, var(--pd-ink-muted) 35%, transparent);
  border-radius: var(--pd-radius-card);
  background: var(--pd-field-fill);
  box-shadow: var(--pd-field-press);
  text-align: center;
  cursor: pointer;
  position: relative;
  transition: box-shadow var(--pd-motion-settle) ease, background-color var(--pd-motion-settle) ease;
}

.drop:hover, .drop-over { border-color: var(--pd-focus); background: var(--pd-accent-soft); }

.drop-glyph { width: 30px; height: 30px; fill: var(--pd-accent); }

.drop .btn { margin: 4px 0 8px; }
.drop .btn::after { content: ""; position: absolute; inset: 0; border-radius: inherit; } /* the whole box is the button's click area */
.drop .btn:active:not(:disabled) { transform: none; } /* a transform would shrink that area back to the button mid-press */
.drop-formats { font-weight: 600; }

.uploader:not([data-state="idle"]) .drop,
.uploader[data-state="idle"] .file-chip,
.uploader:not([data-state="uploading"]) .progress,
.up-line:empty,
.up-actions:empty {
  display: none;
}

.file-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 6px 10px 14px;
  border-radius: 14px;
  background: var(--pd-paper-raised);
  box-shadow: var(--pd-emboss-pressed);
}

.chip-bad { box-shadow: inset 0 0 0 1.5px var(--pd-danger); }

.chip-glyph {
  width: 26px;
  height: 26px;
  flex: none;
  fill: var(--pd-accent);
}

.chip-thumb {
  width: 32px;
  height: 48px;
  flex: none;
  border-radius: 3px;
  object-fit: cover;
}

.chip-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.chip-name {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--pd-field-well);
  box-shadow: var(--pd-deboss);
}

.progress-fill {
  width: 0;
  height: 100%;
  background: var(--pd-accent);
  transition: width var(--pd-motion-settle) linear;
}

.up-line .spinner { margin-right: 8px; color: var(--pd-accent); }

.up-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---- Add book steps */

.steps { display: flex; gap: 12px; }

.steps li {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 10px;
  color: var(--pd-ink-muted);
  font-size: var(--pd-type-label);
  font-weight: 600;
}

.steps li:not(:last-child)::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--pd-line);
}

.steps .current { color: var(--pd-ink); }
.step-num { width: 28px; height: 28px; font-size: var(--pd-type-small); }
.done .step-num { box-shadow: inset 0 0 0 1.5px var(--pd-accent); color: var(--pd-accent); }
.wizard .sheet-foot .btn-ghost { margin-right: auto; }
.wizard .sheet-foot .actions { flex: 1; justify-content: flex-end; }

/* ---- Contents, offers, preview */

.toc li {
  display: grid;
  grid-template-columns: minmax(80px, 140px) minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 6px 0 6px calc(var(--depth, 0) * 20px);
}

.toc-kind { overflow: hidden; text-overflow: ellipsis; }
.toc-read { font-weight: 600; padding: 8px 4px; }
.toc li.toc-part { display: block; padding: 18px 0 4px; }
.toc-part h3 { margin: 0; font-family: var(--pd-display); font-size: 19px; }
/* The chapter list with its actions; on narrow screens the actions wrap under the name. */
.toc-edit li { grid-template-columns: minmax(70px, 96px) minmax(220px, 1fr) auto; }
.toc-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 2px 10px; }
.toc-actions .btn { min-width: 44px; min-height: 44px; padding: 0 12px; }

/* A quiet explanation box inside a sheet (where things come from, what can change). */
.note-box {
  display: grid;
  gap: 8px;
  margin: 4px 0 18px;
  padding: 14px 16px;
  border: 1px solid color-mix(in srgb, var(--pd-accent) 14%, transparent);
  border-radius: var(--pd-radius);
  background: color-mix(in srgb, var(--pd-accent) 5%, var(--pd-paper-raised));
  color: var(--pd-ink-muted);
  font-size: var(--pd-type-small);
  line-height: 1.5;
}

.offers li { display: flex; justify-content: space-between; gap: 12px; }

.preview { max-width: calc(var(--pd-content-list) + 2 * var(--pd-pad-x)); }

.preview-bar { display: flex; align-items: center; gap: 10px; }

.preview-bar .field { flex: 1; }
/* The app's reader page: Literata on raised paper, a comfortable measure */
.reader-page {
  padding: clamp(28px, 6vw, 64px) clamp(20px, 6vw, 72px);
  font-family: var(--pd-font-reading), Georgia, serif;
  font-size: 19px;
  line-height: 1.7;
}

.reader-page h2, .reader-page h3 { margin-bottom: 24px; font-size: var(--pd-type-title); line-height: 1.15; }

.reader-page p + p { margin-top: 1em; }

/* Book images fit the reading column */
.reader-figure { margin: 1.4em 0; }
.reader-figure img { display: block; max-width: 100%; height: auto; margin-inline: auto; border-radius: var(--pd-radius); }
.reader-figure.is-loading, .reader-figure.is-broken {
  display: grid;
  place-items: center;
  min-height: 160px;
  border-radius: var(--pd-radius);
  background: var(--pd-paper);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--pd-shadow) 8%, transparent);
}
.reader-figure figcaption { padding: 16px; font-family: var(--pd-ui); font-size: 15px; color: var(--pd-ink-muted); text-align: center; }

.reader-kicker {
  margin-bottom: 8px;
  color: var(--pd-brass);
  font-family: var(--pd-ui);
  font-size: var(--pd-type-small);
  font-weight: 600;
}

/* ---- Narrow */

/* Drawer mode (shared/shell.ts sets it from the site's own breakpoint: publisher 960px, desk 768px). */
.app.drawer-mode { display: block; }
.drawer-mode .drawer-close { display: inline-grid; }
.drawer-mode .app-main { padding-top: 8px; }

.drawer-mode .app-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--pd-control-height);
  padding: 4px 12px 4px 4px;
  background: color-mix(in srgb, var(--pd-paper) 92%, transparent);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.drawer-mode .sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: min(288px, 86vw);
  height: 100%;
  border-right: 0;
  border-radius: 0 var(--pd-radius-card) var(--pd-radius-card) 0;
  background: var(--pd-paper-raised);
  box-shadow: var(--pd-emboss);
  transform: translateX(-105%);
  visibility: hidden;
  transition:
    transform var(--pd-motion-page) var(--pd-ease),
    visibility 0s linear var(--pd-motion-page);
}

.drawer-mode.drawer-open .sidebar {
  transform: none;
  visibility: visible;
  transition: transform var(--pd-motion-page) var(--pd-ease);
}

.drawer-mode .scrim {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: block;
  background: color-mix(in srgb, var(--pd-shadow) 32%, transparent);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--pd-motion-page) ease;
}

.drawer-mode.drawer-open .scrim { opacity: 1; pointer-events: auto; }

.menu-btn { display: none; }
.drawer-mode .menu-btn { display: inline-grid; }

@media (max-width: 859px) {
  .page-head h1, .book-head h1 { font-size: var(--pd-type-section); }

  .book-sub { font-size: var(--pd-type-body); }
  .sheet { padding: 20px 18px; }
  .toolbar .search { flex-basis: 100%; }
  .book-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 28px 16px; }
  .cover-sm { width: 60px; }
  .cover-lg { width: 110px; }
  .steps li:not(.current) span + span { display: none; }
  .wizard .sheet-foot .actions { flex-direction: column-reverse; }
  .toc li { grid-template-columns: minmax(0, 1fr) auto; gap: 4px; }
  .toc li .field { grid-column: 1 / -1; }
  .toc-edit li { grid-template-columns: minmax(0, 1fr); }
  .toc-actions { justify-content: flex-start; }
  .reader-page { font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }

  .btn:active:not(:disabled), .book-card:hover .cover { transform: none; }
}

/* ==== Desk console (web/desk). Sidebar of wings (icons only at 768-1199px, a drawer under 768px),
   a sticky top bar (title, search, who), records as tables that fold into cards on a narrow page. */

.console { grid-template-columns: 248px minmax(0, 1fr); grid-template-rows: auto 1fr; }
.console > .sidebar { grid-column: 1; grid-row: 1 / span 2; }
.console > .topbar { grid-column: 2; grid-row: 1; }
.console > .app-main { grid-column: 2; grid-row: 2; }
.console.rail-mode { grid-template-columns: 76px minmax(0, 1fr); }

.brand-sub { color: var(--pd-accent); }
.console .side-top { padding: 0 6px 6px; }
.console .side-nav a { position: relative; }
.side-badge {
  margin-left: auto;
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--pd-accent);
  color: var(--pd-accent-ink);
  font-size: 11.5px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}
.side-nav a[aria-current="page"] .side-badge { background: var(--pd-paper-raised); color: var(--pd-accent); box-shadow: var(--pd-emboss-pressed); }
.side-who { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: var(--pd-type-label); }
.side-email { flex: 1 1 100%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Rail: icons only, labels kept for screen readers, badges become a dot on the icon. */
.rail-mode .sidebar { padding: 18px 10px; align-items: center; }
.rail-mode .side-top { padding: 0 0 8px; justify-content: center; }
.rail-mode .brand-text, .rail-mode .side-group, .rail-mode .side-who { display: none; }
.rail-mode .side-nav ul + .side-group + ul { margin-top: 0; }
.rail-mode .side-nav ul:not(:first-of-type) { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--pd-line); }
.rail-mode .side-nav a, .rail-mode .side-out { justify-content: center; width: 52px; min-height: 46px; padding: 0; }
.rail-mode .side-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.rail-mode .side-badge {
  position: absolute;
  top: 5px;
  right: 6px;
  min-width: 18px;
  padding: 0 4px;
  font-size: 10px;
  line-height: 16px;
  box-shadow: 0 0 0 2px var(--pd-paper-raised);
}

/* Top bar: sticky over the page, glass like the publisher's phone bar. */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  min-height: 68px;
  padding: 10px var(--pd-gutter);
  border-bottom: 1px solid color-mix(in srgb, var(--pd-line) 70%, transparent);
  background: color-mix(in srgb, var(--pd-paper) 90%, transparent);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.top-title {
  flex: 0 1 auto;
  min-width: 0;
  margin: 0 8px 0 0;
  font-size: 26px;
  letter-spacing: -0.6px;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.top-search, .list-search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 280px;
  max-width: 460px;
  margin: 0;
}
.top-search svg, .list-search svg {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  fill: var(--pd-ink-muted);
  pointer-events: none;
}
.top-search input, .list-search input {
  width: 100%;
  height: 44px;
  padding: 0 14px 0 40px;
  border: 0;
  border-radius: 999px;
  background: var(--pd-field-well);
  box-shadow: var(--pd-deboss);
  color: var(--pd-ink);
  font: inherit;
  font-size: var(--pd-type-label);
  outline: none;
}
.top-search input:focus, .list-search input:focus { box-shadow: var(--pd-deboss-focused); }
.top-search { margin-left: auto; }
.top-who { display: inline-flex; align-items: center; gap: 8px; color: var(--pd-ink-muted); font-size: var(--pd-type-label); }
.rail-mode .top-email { display: none; }
.top-email { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge svg { width: 13px; height: 13px; margin-right: 4px; fill: currentColor; flex: none; }
.badge-ok { background: var(--pd-accent-soft); color: var(--pd-accent); }

.console .app-main { padding-top: clamp(18px, 2.4vw, 32px); }
.console .page { gap: 0; }
.console .stack { gap: clamp(16px, 1.8vw, 22px); }
.stack-tight { display: flex; flex-direction: column; gap: 4px; }
.small { font-size: var(--pd-type-small); }
.console .panel { padding: clamp(16px, 2vw, 24px); }
.panel-title { font-size: var(--pd-type-bar); letter-spacing: -0.3px; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.panel-frozen { box-shadow: var(--pd-emboss), inset 3px 0 0 var(--pd-warn); }
.page-intro { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; }
.page-intro p, .page-intro-text { max-width: 72ch; color: var(--pd-ink-muted); }
.page-intro .actions { margin: 0; }
.console .btn { min-width: 0; height: 44px; padding: 0 20px; gap: 8px; border-radius: 14px; font-size: var(--pd-type-label); }
.console .btn-sm { height: 36px; padding: 0 14px; border-radius: 12px; }
.console .btn-ghost { height: 36px; padding: 0 10px; }
.btn-danger { --face: var(--pd-danger); --fg: var(--pd-accent-ink); }
.console .actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; }
.side-actions .btn { flex: 1 1 150px; }
.console .field input, .console .field select, .console .field textarea { height: 46px; border-radius: 14px; font-size: var(--pd-type-label); }
.console .field textarea { height: auto; }
.console .field label { padding: 0; color: var(--pd-ink); font-size: var(--pd-type-label); }

/* Record header: back link, kicker, the record's name. */
.record-head { display: flex; flex-direction: column; gap: 4px; margin-bottom: clamp(14px, 1.8vw, 22px); }
.back-link { display: inline-flex; align-items: center; gap: 4px; align-self: flex-start; font-size: var(--pd-type-label); }
.back-link svg { width: 16px; height: 16px; fill: currentColor; }
.kicker { margin-top: 6px; color: var(--pd-brass); font-size: var(--pd-type-label); font-weight: 600; }
.record-name { font-size: clamp(24px, 2.6vw, 32px); letter-spacing: -0.7px; line-height: 1.12; overflow-wrap: anywhere; }
.record-head > .btn { align-self: flex-start; }

/* Overview tiles. */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: clamp(12px, 1.4vw, 18px); }
.tile {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: "icon value" "label label" "hint hint";
  align-items: center;
  gap: 6px 12px;
  padding: 18px 20px;
  border-radius: var(--pd-radius-card);
  background: var(--pd-paper-raised);
  box-shadow: var(--pd-emboss);
  color: var(--pd-ink);
  transition: transform var(--pd-motion-press) var(--pd-ease);
}
.tile:hover { text-decoration: none; transform: translateY(-2px); }
.tile:active { transform: scale(0.98); box-shadow: var(--pd-emboss-pressed); }
.tile-icon { grid-area: icon; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 999px; background: var(--pd-field-well); box-shadow: var(--pd-deboss); }
.tile-icon svg { width: 20px; height: 20px; fill: var(--pd-ink-muted); }
.tile-hot .tile-icon { background: var(--pd-accent-soft); }
.tile-hot .tile-icon svg { fill: var(--pd-accent); }
.tile-value { grid-area: value; justify-self: end; font-family: var(--pd-display); font-size: 32px; font-weight: 600; line-height: 1; letter-spacing: -0.8px; }
.tile-label { grid-area: label; color: var(--pd-ink-muted); font-size: var(--pd-type-label); font-weight: 600; }
.tile-hint { grid-area: hint; color: var(--pd-ink-muted); font-size: var(--pd-type-small); }

/* List tools: chip groups wrap, the search sits at the end. */
.list-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; }
.list-filters { display: flex; flex-wrap: wrap; gap: 10px 18px; min-width: 0; }
.list-tools .list-search { flex: 1 1 260px; max-width: 360px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: var(--pd-paper-raised);
  box-shadow: var(--pd-emboss-pressed), -1px -1px 3px color-mix(in srgb, var(--pd-highlight) 70%, transparent);
  color: var(--pd-ink-muted);
  font: inherit;
  font-size: var(--pd-type-label);
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--pd-motion-press) var(--pd-ease);
}
.chip:hover { color: var(--pd-ink); }
.chip:active { transform: scale(var(--pd-motion-press-scale)); }
.chip[aria-pressed="true"] { background: var(--pd-accent-soft); box-shadow: var(--pd-deboss); color: var(--pd-accent); }
.chip-count { min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--pd-field-well); color: var(--pd-ink-muted); font-size: 11.5px; line-height: 18px; text-align: center; }
.chip[aria-pressed="true"] .chip-count { background: var(--pd-paper-raised); color: var(--pd-accent); }

/* Records: a table when there is room, cards under 520px of list width. The header sticks under the top bar. */
.records { container: records / inline-size; }
.records-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.records-table th, .records-table td { padding: 12px 14px; border-bottom: 1px solid var(--pd-line); text-align: left; vertical-align: middle; }
.records-table td { white-space: nowrap; }
.records-table td.wrap, .records-table td:first-child { white-space: normal; overflow-wrap: anywhere; }
.records-table td:first-child { min-width: 12rem; font-weight: 600; }
.records-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.records-table .mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: var(--pd-type-small); }
.records-table thead th {
  position: sticky;
  top: 68px;
  z-index: 1;
  padding-top: 10px;
  padding-bottom: 10px;
  background: color-mix(in srgb, var(--pd-paper) 94%, transparent);
  color: var(--pd-ink-muted);
  font-size: var(--pd-type-small);
  font-weight: 600;
  white-space: nowrap;
}
.panel .records-table thead th { background: color-mix(in srgb, var(--pd-paper-raised) 96%, transparent); }
.records-table tbody tr:last-child td { border-bottom: 0; }
.records-table .row-link { cursor: pointer; }
.records-table .row-link:hover td { background: color-mix(in srgb, var(--pd-accent-soft) 45%, transparent); }
.row-open { color: var(--pd-ink); }
.row-link:hover .row-open { color: var(--pd-accent); text-decoration: none; }
.sort { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
.sort-mark { width: 12px; height: 12px; fill: currentColor; opacity: 0.35; }
[aria-sort] .sort-mark { opacity: 1; }
[aria-sort="ascending"] .sort-mark { transform: rotate(180deg); }
.row-actions { display: inline-flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
.records:not(.panel *) { padding: 6px clamp(10px, 1.4vw, 16px); border-radius: var(--pd-radius-card); background: color-mix(in srgb, var(--pd-paper-raised) 70%, transparent); box-shadow: var(--pd-emboss); }

/* Medium lists: cells wrap, and a still-too-wide table scrolls inside its own card, never the page. */
@container records (max-width: 899px) {
  .records-scroll { overflow-x: auto; }
  .records-table thead th { position: static; }
  .records-table .opt { display: none; }
  .records-table td.nowrap { white-space: nowrap; }
  .records-table td { white-space: normal; }
  .records-table td:first-child { min-width: 9rem; }
  .records-table th, .records-table td { padding: 10px 10px; }
}

@container records (max-width: 519px) {
  .records-table, .records-table tbody { display: block; }
  .records-table thead { display: none; }
  .records-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px 14px;
    padding: 14px 4px;
    border-bottom: 1px solid var(--pd-line);
  }
  .records-table tbody tr:last-child { border-bottom: 0; }
  .records-table td { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 0; border: 0; white-space: normal; min-width: 0; }
  .records-table td::before { content: attr(data-label); color: var(--pd-ink-muted); font-size: var(--pd-type-small); font-weight: 600; }
  .records-table td:first-child { grid-column: 1 / -1; min-width: 0; font-size: var(--pd-type-body); }
  .records-table td:first-child::before, .records-table td[data-label=""]::before { display: none; }
  .records-table td[data-label=""] { grid-column: 1 / -1; align-items: flex-start; }
  .records-table td[data-label=""]:empty { display: none; }
  .records-table .num { text-align: left; }
  .records-table .row-link:hover td { background: none; }
  .row-actions { justify-content: flex-start; }
}

.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }

/* Empty, error, loading. */
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: clamp(32px, 6vw, 64px) 24px; text-align: center; border-radius: var(--pd-radius-card); background: color-mix(in srgb, var(--pd-paper-raised) 50%, transparent); box-shadow: var(--pd-deboss); }
.panel .empty-state { background: none; box-shadow: none; padding: 28px 12px; }
.empty-state p { max-width: 52ch; }
.empty-well { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 999px; background: var(--pd-accent-soft); box-shadow: var(--pd-deboss); }
.empty-well svg { width: 26px; height: 26px; fill: var(--pd-accent); }
.empty-error .empty-well { background: color-mix(in srgb, var(--pd-danger) 10%, var(--pd-paper)); }
.empty-error .empty-well svg { fill: var(--pd-danger); }
.skeleton { display: flex; flex-direction: column; gap: 12px; }
.bone { display: block; height: 44px; border-radius: 14px; background: var(--pd-field-well); opacity: 0.85; }
.bone:nth-child(3n + 2) { width: 92%; opacity: 0.7; }
.bone:nth-child(3n) { width: 78%; opacity: 0.55; }
.tiles > .skeleton { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 14px; }
.tiles > .skeleton .bone { height: 116px; width: auto; border-radius: var(--pd-radius-card); }
.skeleton-record .bone:first-child { height: 34px; width: 40%; }
.skeleton-record .bone { height: 120px; }

/* Toasts: floating ink pills. */
.toasts { position: fixed; left: 50%; bottom: 24px; z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 8px; transform: translateX(-50%); width: min(92vw, 520px); pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: 999px; background: var(--pd-ink); color: var(--pd-accent-ink); box-shadow: 0 10px 30px -8px color-mix(in srgb, var(--pd-shadow) 60%, transparent); font-size: var(--pd-type-label); font-weight: 600; animation: pd-toast-in var(--pd-motion-settle) var(--pd-ease); transition: opacity 0.4s ease, transform 0.4s ease; }
.toast svg { width: 18px; height: 18px; flex: none; fill: currentColor; }
.toast-bad { background: var(--pd-danger); }
.toast-out { opacity: 0; transform: translateY(8px); }
@keyframes pd-toast-in { from { opacity: 0; transform: translateY(10px); } }

/* Dialogs: raised paper on a soft ink drop. */
.dialog {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: clamp(20px, 3vw, 28px);
  border: 0;
  border-radius: var(--pd-radius-card);
  background: var(--pd-paper-raised);
  color: var(--pd-ink);
  box-shadow: 0 24px 60px -12px color-mix(in srgb, var(--pd-shadow) 45%, transparent);
}
.dialog::backdrop { background: color-mix(in srgb, var(--pd-shadow) 36%, transparent); }
.dialog h2 { font-size: var(--pd-type-section); }
.dialog .btn { min-width: 0; height: 46px; padding: 0 22px; border-radius: 14px; font-size: var(--pd-type-label); }
.dialog .btn-ghost { height: 46px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }
.two-keys { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 14px; background: var(--pd-accent-soft); color: var(--pd-accent); font-size: var(--pd-type-label); font-weight: 600; }
.two-keys svg { width: 20px; height: 20px; flex: none; fill: currentColor; }
.dialog .row { display: flex; flex-wrap: wrap; gap: 14px; }
.dialog .row > .field { flex: 1 1 160px; }
.dialog .field input, .dialog .field select, .dialog .field textarea { height: 46px; border-radius: 14px; font-size: var(--pd-type-label); }
/* A pick-several list (Rates: Sells in): a debossed well that scrolls, no caret. */
.field select[multiple] { height: auto; padding: 8px 12px; background: var(--pd-field-fill); }
.dialog .field textarea { height: auto; }

.flag-wait { color: var(--pd-accent); background: color-mix(in srgb, var(--pd-accent) 7%, transparent); }
.flag-wait strong { display: flex; align-items: flex-start; gap: 6px; }
.flag-wait svg { width: 16px; height: 16px; margin-top: 3px; flex: none; fill: currentColor; }
.flag .actions { margin-top: 8px; }

.trail { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0 0 0 14px; list-style: none; border-left: 2px solid var(--pd-line); }
.trail li { display: flex; flex-direction: column; gap: 2px; font-size: var(--pd-type-label); }
.trail li strong { font-weight: 600; }
.trail .muted { font-size: var(--pd-type-small); }

.reviews { display: flex; flex-direction: column; gap: 0; margin: 0; padding: 0; list-style: none; }
.review { display: flex; flex-direction: column; gap: 8px; padding: 14px 0; border-bottom: 1px solid var(--pd-line); }
.review:last-child { border-bottom: 0; }

.lookup { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); align-items: end; gap: 14px; }
.lookup > .btn { justify-self: start; }

.proposals { display: flex; flex-direction: column; gap: 12px; margin: 0; padding: 0; list-style: none; }
.proposal { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; padding: 16px 20px; border-radius: var(--pd-radius-card); background: var(--pd-paper-raised); box-shadow: var(--pd-emboss); }
.proposal-text { display: flex; flex-direction: column; gap: 6px; flex: 1 1 360px; min-width: 0; }
.proposal .actions { align-items: center; }

.check { display: flex; align-items: center; gap: 10px; font-size: var(--pd-type-label); font-weight: 600; }
.check input { width: 20px; height: 20px; accent-color: var(--pd-accent); }

.console .tabs { margin-top: 0; }
.console .summary div { padding: 6px 0; }
.console .summary div:last-child { border-top: 1px solid var(--pd-line); padding-top: 10px; }

/* Phones: the bar wraps the search under the title; the email hides (it is in the drawer). */
@media (max-width: 767px) {
  .topbar { min-height: 60px; padding: 8px 12px; gap: 8px; }
  .top-title { flex: 1 1 0; font-size: 21px; }
  .top-search { order: 5; flex-basis: 100%; max-width: none; margin-left: 0; }
  .top-search input { height: 40px; }
  .top-email { display: none; }
  .records-table thead th { top: 112px; }
  .list-tools .list-search { max-width: none; }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions .btn { width: 100%; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile { padding: 14px 16px; }
  .tile-value { min-width: 0; font-size: clamp(19px, 5.6vw, 26px); }
}

/* One column: the record's state leads, its trail goes last (after the work). */
@container page (max-width: 879px) {
  .console .split > .split-side { display: contents; }
  .console .split > .split-main { order: 2; }
  .console .split-side > .trail-panel { order: 3; }
}

/* ---- Publisher: series and bundles */

.section-title { font-size: var(--pd-type-bar); }
.collections, .collection-books, .pick-list { margin: 0; padding: 0; list-style: none; }
.collections { display: flex; flex-direction: column; gap: 16px; }
.collection-books { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 14px 12px; }
.collection-books li { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.collection-books .cover-sm { width: 72px; }
.collection-pos { color: var(--pd-ink-muted); font-size: var(--pd-type-small); font-weight: 600; }
.collection-title { font-size: var(--pd-type-small); line-height: 1.3; overflow-wrap: anywhere; }
.pick-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 6px 0; border-bottom: 1px solid var(--pd-line); }
.pick-list li:last-child { border-bottom: 0; }
.pick-pos { width: 1.6em; color: var(--pd-ink-muted); font-variant-numeric: tabular-nums; }
.pick-title { flex: 1 1 10rem; min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.pick-actions { display: flex; gap: 2px; margin-left: auto; }
.pick-actions .btn-ghost { height: 32px; padding: 0 8px; }
.field .label { font-size: var(--pd-type-label); font-weight: 600; }

/* ---- Publisher: claims (phase 17). Desk record tables inside a sheet: no second plate, no sticky head. */

.sheet .records { padding: 0; background: none; box-shadow: none; }
.sheet .records-table thead th { position: static; background: none; }
.sheet .records-table td.wrap, .sheet .records-table td:first-child { overflow-wrap: break-word; }
.code-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(21ch, 1fr));
  gap: 6px 16px;
  max-height: 320px;
  margin: 0;
  padding: 14px 16px;
  overflow-y: auto;
  list-style: none;
  border-radius: 14px;
  background: var(--pd-field-well);
  box-shadow: var(--pd-deboss);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: var(--pd-type-label);
}

/* ---- Reading stats (shared/reading.ts: publisher book Reading tab, desk Reading) */
.reading-bar { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 16px; }
.reading-range { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 14px; min-width: 0; }
.reading-date { flex: 1 1 140px; max-width: 200px; }
.reading-range .chips { padding-bottom: 6px; }
.reading-loading { opacity: 0.55; transition: opacity var(--pd-motion-settle) ease; }
.reading-tile:hover, .reading-tile:active { transform: none; box-shadow: var(--pd-emboss); }
.tile-value.tile-none { font-family: inherit; font-size: var(--pd-type-label); font-weight: 600; letter-spacing: 0; line-height: 1.3; color: var(--pd-ink-muted); text-align: right; }
.reading-note { display: flex; align-items: flex-start; gap: 10px; max-width: 80ch; margin: 0; color: var(--pd-ink-muted); font-size: var(--pd-type-label); }
.reading-note svg { flex: none; width: 18px; height: 18px; margin-top: 2px; fill: var(--pd-accent); }
.reading-none { font-size: var(--pd-type-small); }
.funnel { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; }
.funnel-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 6px 12px; }
.funnel-title { font-weight: 600; overflow-wrap: anywhere; }
.funnel-count { font-variant-numeric: tabular-nums; font-weight: 600; }
.funnel-track { display: block; grid-column: 1 / -1; height: 10px; overflow: hidden; border-radius: 999px; background: var(--pd-field-well); box-shadow: var(--pd-deboss); }
.funnel-fill { display: block; height: 100%; border-radius: inherit; background: var(--pd-accent); }
.funnel-none { grid-column: 1 / -1; }
.sheet .reading-table { padding: 0; background: none; box-shadow: none; }
.reading-lists { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: clamp(12px, 1.4vw, 18px); }
.reading-top { display: grid; gap: 10px; margin: 0; padding-left: 1.3em; }
.reading-top li strong { display: block; overflow-wrap: anywhere; }
.reading-top li span { display: block; font-size: var(--pd-type-small); }
.day-chart { display: flex; align-items: flex-end; gap: clamp(1px, 0.3vw, 4px); height: 180px; padding-top: 8px; border-bottom: 1px solid var(--pd-line); }
.day-bar { flex: 1 1 0; min-width: 0; max-width: 28px; border-radius: 3px 3px 0 0; background: var(--pd-accent); }
.day-axis { display: flex; justify-content: space-between; gap: 12px; font-size: var(--pd-type-small); }
.reading-open { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.reading-open .field { flex: 1 1 280px; }
.reading-open .note { flex-basis: 100%; }
.press-reading svg { width: 16px; height: 16px; fill: currentColor; }
/* Reading stats, phase 37: the biggest drop, the hour grid, one chapter's tenths */
/* Dialogs (native <dialog>): raised paper at radiusCard on a soft ink drop, over a dimmed page. */
.dialog { width: min(640px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: clamp(18px, 3vw, 28px); border: 0; border-radius: var(--pd-radius-card); background: var(--pd-paper-raised); color: var(--pd-ink); box-shadow: 0 24px 64px color-mix(in srgb, var(--pd-shadow) 28%, transparent); overflow: auto; overscroll-behavior: contain; }
/* The dialog is the one surface: a sheet inside it (the Add book wizard) lies flat on it. */
.dialog .sheet { padding: 0; background: none; box-shadow: none; }
.dialog .sheet-foot { position: sticky; bottom: calc(-1 * clamp(18px, 3vw, 28px)); margin-top: 8px; padding: 14px 0 clamp(18px, 3vw, 28px); background: var(--pd-paper-raised); }
/* Phones: a sheet from the bottom edge, full width. */
@media (max-width: 600px) {
  .dialog { width: 100vw; max-width: none; margin: auto 0 0; border-radius: var(--pd-radius-card) var(--pd-radius-card) 0 0; }
}
.dialog::backdrop { background: color-mix(in srgb, var(--pd-shadow) 38%, transparent); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.dialog-head h2 { margin: 0; }
@media (prefers-reduced-motion: no-preference) {
  .dialog[open] { animation: dialog-in var(--pd-motion-settle, 220ms) ease-out; }
  @keyframes dialog-in { from { opacity: 0; transform: translateY(12px) scale(0.98); } }
}
.part-head h2 { margin: 0; }
.part-head p { margin: 4px 0 0; }
.tab-part { scroll-margin-top: 16px; }
.link-button { padding: 0; border: 0; background: none; color: var(--pd-focus); font: inherit; font-weight: 600; text-align: left; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.link-button:focus-visible { outline: 2px solid var(--pd-focus); outline-offset: 2px; border-radius: 4px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* The opening: the drop as a sentence, the facts, then the book ribbon (readers still reading, by page). */
.reading-hero { display: grid; gap: clamp(16px, 2vw, 24px); }
.reading-lede { max-width: 32ch; margin: 0; font-family: var(--pd-display); font-size: clamp(24px, 2.4vw, 32px); font-weight: 500; line-height: 1.18; letter-spacing: -0.4px; text-wrap: balance; }
.reading-facts { grid-template-columns: repeat(auto-fill, minmax(min(100%, 160px), 1fr)); }
.reading-fact { font-family: var(--pd-display); font-size: var(--pd-type-section); font-weight: 500; font-variant-numeric: lining-nums tabular-nums; }
.reading-fact-hint { display: block; font-size: var(--pd-type-small); font-weight: 500; }
.ribbon { margin: 0; padding: 18px 16px 12px; border-radius: var(--pd-radius-card); background: var(--pd-field-well); box-shadow: var(--pd-deboss); }
.ribbon-plot { position: relative; height: clamp(120px, 15vw, 190px); }
.ribbon-svg { display: block; width: 100%; height: 100%; overflow: visible; }
.ribbon-svg path { fill: color-mix(in srgb, var(--pd-accent) 20%, transparent); stroke: var(--pd-accent); stroke-width: 2; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.ribbon-pin { position: absolute; width: 16px; height: 16px; margin: -8px 0 0 -8px; border: 3px solid var(--pd-accent); border-radius: 50%; background: var(--pd-paper-raised); box-shadow: var(--pd-emboss); }
.ribbon-marks { display: flex; margin-top: 10px; }
.ribbon-mark { flex: 1 1 0; min-width: 0; padding: 2px 8px 2px 6px; border: 0; border-left: 2px solid var(--pd-brass); background: none; color: var(--pd-ink-muted); font: inherit; font-size: var(--pd-type-small); font-weight: 600; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.ribbon-mark:hover:not(:disabled) { color: var(--pd-ink); }
.ribbon-mark:focus-visible { outline: 2px solid var(--pd-focus); outline-offset: 2px; border-radius: 4px; }
.ribbon-mark:disabled { cursor: default; opacity: 0.6; }
.ribbon-axis { display: flex; justify-content: space-between; margin-top: 6px; font-size: var(--pd-type-small); }
.reading-pick { max-width: 420px; }
.heat-scroll { overflow-x: auto; }
.heat { display: grid; grid-template-columns: 3.2em repeat(24, minmax(12px, 1fr)); gap: 3px; min-width: 420px; font-size: var(--pd-type-small); }
.heat-hour { white-space: nowrap; color: var(--pd-ink-muted); }
.heat-day { color: var(--pd-ink-muted); align-self: center; }
.heat-cell { aspect-ratio: 1; border-radius: 3px; background: color-mix(in srgb, var(--pd-accent) calc(var(--heat, 0) * 100%), var(--pd-field-well)); }

/* ---- Desk Messages (web/desk/messages.ts): composer counters, image, and the live phone preview */
.msg-choices { gap: 10px 22px; }
.msg-cell { display: flex; flex-direction: column; gap: 2px; }
.msg-cell .small { font-weight: 500; }
.msg-group { display: flex; flex-direction: column; gap: 8px; }
.msg-group .label { font-size: var(--pd-type-label); font-weight: 600; }
.msg-group .help { margin: -4px 0 0; }
.msg-count { align-self: flex-end; color: var(--pd-ink-muted); font-size: var(--pd-type-small); font-variant-numeric: tabular-nums; }
.console .field .msg-file { height: auto; padding: 10px 12px; }
.msg-image { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.msg-image:empty { display: none; }
.msg-image img { width: 160px; max-width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 12px; box-shadow: var(--pd-emboss); }
.msg-audience-count { margin: 0; font-size: var(--pd-type-section); line-height: 1.25; }
.msg-audience-count strong { font-variant-numeric: tabular-nums; color: var(--pd-accent); }
.msg-phone { display: flex; flex-direction: column; gap: 14px; padding: 16px 14px 20px; border-radius: 28px; background: var(--pd-field-well); box-shadow: var(--pd-deboss); }
.msg-pv { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.msg-pv-label { color: var(--pd-ink-muted); font-size: var(--pd-type-small); font-weight: 600; }
.msg-pv p { margin: 0; }
.msg-pv strong { display: block; overflow-wrap: anywhere; line-height: 1.3; }
.msg-pv-meta { color: var(--pd-ink-muted); font-size: var(--pd-type-small); }
.msg-pv-clamp { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; font-size: var(--pd-type-label); color: var(--pd-ink-muted); }
.msg-pv-push, .msg-pv-banner, .msg-pv-inbox { display: grid; align-items: start; gap: 10px; padding: 12px 14px; border-radius: 18px; background: var(--pd-paper-raised); box-shadow: var(--pd-emboss); }
.msg-pv-push { grid-template-columns: 32px minmax(0, 1fr); background: color-mix(in srgb, var(--pd-paper-raised) 78%, transparent); }
.msg-pv-app { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--pd-accent); }
.msg-pv-app svg { width: 18px; height: 18px; fill: var(--pd-accent-ink); }
.msg-pv-banner { grid-template-columns: 20px minmax(0, 1fr) 16px; background: var(--pd-accent-soft); }
.msg-pv-banner svg { width: 20px; height: 20px; fill: var(--pd-accent); }
.msg-pv-banner svg:last-child { width: 16px; height: 16px; fill: var(--pd-ink-muted); }
.msg-pv-popup { display: flex; flex-direction: column; gap: 8px; padding: 16px; border-radius: 22px; background: var(--pd-paper-raised); box-shadow: 0 18px 40px -16px color-mix(in srgb, var(--pd-shadow) 45%, transparent), var(--pd-emboss); }
.msg-pv-popup > p { font-size: var(--pd-type-label); overflow-wrap: anywhere; white-space: pre-line; }
.msg-pv-img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 14px; }
.msg-pv-inbox { grid-template-columns: 10px minmax(0, 1fr) auto; }
.msg-pv-inbox .msg-pv-img { width: 56px; aspect-ratio: 1; border-radius: 10px; }
.msg-pv-dot { width: 8px; height: 8px; margin-top: 7px; border-radius: 999px; background: var(--pd-accent); }
.msg-pv-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.msg-pv-btn { padding: 8px 16px; border-radius: 12px; background: var(--pd-accent); color: var(--pd-accent-ink); font-size: var(--pd-type-small); font-weight: 600; }
.msg-pv-btn.quiet { background: none; color: var(--pd-ink-muted); }
.msg-lock { color: var(--pd-warn); background: color-mix(in srgb, var(--pd-warn) 9%, transparent); }
/* One column: the form leads and the preview follows it (other desk records lead with their side). */
@container page (max-width: 879px) {
  .console .split.msg-compose > .split-side { display: flex; order: 3; }
}

/* ---- Storefront preview (publisher site): a miniature of the shop's top in its own accent */
.sf-preview { display: grid; gap: 8px; }
.sf-preview-url { font-size: var(--pd-type-small); color: var(--pd-ink-muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.sf-preview-page {
  display: grid; gap: 10px; padding: 16px; border-radius: var(--pd-radius);
  background: var(--pd-paper); box-shadow: var(--pd-deboss);
  border-top: 4px solid var(--sf-accent, var(--pd-accent));
}
.sf-preview-page h3 { margin: 0; font-family: var(--pd-font-display); font-size: var(--pd-type-section); overflow-wrap: anywhere; }
.sf-preview-bar { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sf-preview-bar strong { overflow-wrap: anywhere; }
.sf-preview-bar img { width: 36px; height: 36px; object-fit: contain; border-radius: 8px; background: var(--pd-paper-raised); }
.sf-preview-band { margin: 0; font-size: var(--pd-type-small); color: var(--pd-ink-muted); }
.sf-preview-btn {
  justify-self: start; padding: 8px 16px; border-radius: 999px; font-weight: 600;
  background: var(--sf-accent, var(--pd-accent)); color: #fff;
}

/* ---- Desk Funnel and Trends (web/desk/insights.ts): one accent, numbers right, no chart junk */
.wf-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.wf-step { display: grid; grid-template-columns: minmax(120px, 160px) 1fr 64px 56px; align-items: center; gap: 12px; }
.wf-track { height: 14px; border-radius: 7px; background: color-mix(in srgb, var(--pd-line) 55%, transparent); overflow: hidden; }
.wf-fill { display: block; height: 100%; border-radius: 7px; background: var(--pd-accent); }
.wf-num, .wf-pct, .trend-total, .trend-last { text-align: right; font-variant-numeric: tabular-nums; }
.wf-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.trend-list { display: grid; gap: 4px; }
.trend { display: grid; grid-template-columns: minmax(140px, 1fr) 120px 150px 170px; align-items: center; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--pd-line); }
.trend:last-child { border-bottom: 0; }
.spark { width: 120px; height: 32px; overflow: visible; }
.spark-line { fill: none; stroke: var(--pd-accent); stroke-width: 1.75; stroke-linejoin: round; stroke-linecap: round; }
.spark-dot { fill: var(--pd-accent); }
.trends .panel-title svg { width: 18px; height: 18px; vertical-align: -3px; fill: currentColor; }
@media (max-width: 600px) {
  .wf-step { grid-template-columns: 1fr 56px 48px; }
  .wf-step .wf-track { grid-column: 1 / -1; grid-row: 2; }
  .trend { grid-template-columns: 1fr auto; }
  .trend .spark { grid-column: 1 / -1; width: 100%; }
  .trend-last { display: none; }
}

/* ---- Publisher Messages (web/publisher/messages.ts) */
.inbox-item { display: grid; gap: 8px; }
.inbox-item > .btn { justify-self: start; }
.inbox-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 12px; }
.inbox-head .note { margin-left: auto; }
.inbox-new .inbox-head strong::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: var(--pd-accent); vertical-align: 2px; }
.inbox-image { width: 100%; max-width: 520px; height: auto; border-radius: 12px; }

/* The browser's file button, in the house style (storefront logo). */
input[type="file"] { font: inherit; color: var(--pd-ink-muted); }
input[type="file"]::file-selector-button {
  margin-right: 12px;
  padding: 8px 18px;
  border: 0;
  border-radius: 999px;
  background: var(--pd-paper-raised);
  color: var(--pd-ink);
  font: inherit;
  font-weight: 600;
  box-shadow: var(--pd-emboss);
  cursor: pointer;
}

/* ---- Printable claim-code QR sheet (publisher Claims, printSheet) */

.qr-print { display: none; }

@media print {
  @page { size: A4; margin: 10mm; }
  body > :not(.qr-print) { display: none !important; }
  body { background: #fff !important; }
  .qr-print { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; color: #000; font-family: Manrope, system-ui, sans-serif; }
  .qr-card { break-inside: avoid; border: 0.3mm dashed #888; padding: 5mm; display: flex; flex-direction: column; align-items: center; gap: 2mm; text-align: center; }
  .qr-card-head { display: flex; gap: 3mm; align-items: center; align-self: stretch; text-align: left; }
  .qr-card-head .qr-cover { width: 12mm; height: 18mm; flex: none; border-radius: 1mm; overflow: hidden; }
  .qr-card-head .qr-cover img { width: 100%; height: 100%; object-fit: cover; }
  .qr-title { margin: 0; font-size: 10pt; font-weight: 700; line-height: 1.2; }
  .qr-house { margin: 0; font-size: 8pt; color: #444; }
  .qr-card svg { width: 34mm; height: 34mm; }
  .qr-code { margin: 0; font: 600 10pt ui-monospace, Menlo, monospace; letter-spacing: 0.5px; }
  .qr-how { margin: 0; font-size: 7.5pt; color: #444; }
}
