/* =====================================================================
   YOUR STORY (/story - STORY-4, docs/claude/STORY.md "The Portal"; significant-moments-story-design.md 8.1)
   The dashboard of a period (This period: the cover, the chapters, How we count), the books (Books) and the Send now dialog.
   The headline numbers are the shared KPI tile (components.css owns wf-kpi*), the daily columns the shared chart, the
   significant-moment tiles and goal cards the Goals page's own (goals.css - R17, one brain). ONE stylesheet owns every sty-*
   class (Tests/ConversationBuilderCssOwnershipTests, Tests/Story/StoryPortalTests); colours, lines, radii and shadows are
   --theme-* / --wf-* tokens only - the cover takes the workspace's own colours through --sty-brand / --sty-accent, set on the
   element from the story's brand (a plain hex colour, checked) and falling back to the theme.
   ===================================================================== */

.sty-page { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.sty-page > .wf-page-header { margin-bottom: 4px; }

/* ---- The bar: the period, a custom period's dates, the language, "As of" ---- */
.sty-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; min-width: 0; }
.sty-bar-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.sty-period,
.sty-lang { width: auto; min-width: 10rem; max-width: 100%; }
.sty-asof { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 0 0 0 auto; color: var(--theme-text-muted); font-size: var(--wf-text-xs); }

/* ---- The story: the cover, then the chapters ---- */
.sty-stack { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.sty-cover { position: relative; overflow: hidden; padding: 22px 24px 20px; border-top: 4px solid var(--sty-brand, var(--theme-primary)); }
.sty-cover::after { content: ""; position: absolute; top: 0; right: 0; width: 96px; height: 4px; background: var(--sty-accent, var(--theme-accent)); }
.sty-cover-kicker { margin: 0; color: var(--theme-text-muted); font-size: var(--wf-text-xs); font-weight: 650; letter-spacing: .06em; text-transform: uppercase; }
.sty-cover-title { margin: 6px 0 4px; color: var(--theme-text-emphasis); font-size: var(--wf-text-h1); font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.sty-cover-window { margin: 0; color: var(--theme-text-secondary); font-size: var(--wf-text-sm); overflow-wrap: anywhere; }

.sty-chapter { display: flex; flex-direction: column; gap: 10px; min-width: 0; scroll-margin-top: var(--wf-sticky-top); }
.sty-chapter-head { min-width: 0; }
.sty-chapter-title { margin: 0; color: var(--theme-text-emphasis); font-size: var(--wf-text-h2); font-weight: 650; }
.sty-chapter-lead { max-width: 720px; margin: 2px 0 0; color: var(--theme-text-secondary); font-size: var(--wf-text-sm); line-height: 1.45; }

/* A chapter whose numbers did not come, or that has nothing to count yet - said in words, never a zero. */
.sty-status { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 14px; padding: 14px 18px; }
.sty-status-text { flex: 1 1 18rem; min-width: 0; margin: 0; color: var(--theme-text-secondary); font-size: var(--wf-text-sm); }

.sty-kpis { min-width: 0; }
.sty-tile { min-width: 0; }
.sty-chart { min-width: 0; padding: 14px 18px 10px; }
.sty-sentence { display: flex; align-items: baseline; gap: 8px; margin: 0; color: var(--theme-text-secondary); font-size: var(--wf-text-sm); }
.sty-sentence > .bi { color: var(--wf-primary-ink); }
.sty-note { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; margin: 0; color: var(--theme-text-muted); font-size: var(--wf-text-xs); line-height: 1.45; }
.sty-muted { color: var(--theme-text-muted); }

/* ---- Tables (conversations, channels, codes, books, deliveries) - they scroll sideways in their card on a phone ---- */
.sty-table-card { min-width: 0; overflow-x: auto; }
.sty-table { width: 100%; margin: 0; font-size: var(--wf-text-sm); }
.sty-table th,
.sty-table td { padding: 9px 14px; vertical-align: top; border-color: var(--wf-line); }
.sty-table thead th { color: var(--theme-text-secondary); font-size: var(--wf-text-xs); font-weight: 650; white-space: nowrap; }
.sty-table tbody th { font-weight: 600; }
.sty-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* Every column reads the same way down (Kirk, 2026-10-13: "so they dont look broken and beaten"): the name column starts left, every
   number column is CENTRED in its header and its cells alike - wf.css's .table thead th (start) outranks a bare .sty-num, and a
   row header th falls back to the browser's centring. */
.sty-table thead th,
.sty-table tbody th[scope="row"] { text-align: start; }
.sty-table thead th.sty-num,
.sty-table td.sty-num { text-align: center; }
.sty-row-link { color: var(--wf-primary-ink); text-decoration: none; overflow-wrap: anywhere; }
.sty-row-link:hover,
.sty-row-link:focus-visible { text-decoration: underline; }
.sty-row-name { color: var(--theme-text-emphasis); overflow-wrap: anywhere; }
.sty-row-note { display: block; margin-top: 2px; color: var(--theme-text-muted); font-size: var(--wf-text-xs); font-weight: 400; }
.sty-row-note > .bi { margin-right: 4px; }

/* ---- Where they left (the busiest conversations) ---- */
.sty-left { min-width: 0; padding: 14px 18px; }
.sty-left-title { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; margin: 0; color: var(--theme-text-emphasis); font-size: var(--wf-text-h3); font-weight: 650; overflow-wrap: anywhere; }
.sty-left-title > a { color: var(--wf-primary-ink); text-decoration: none; }
.sty-left-title > a:hover,
.sty-left-title > a:focus-visible { text-decoration: underline; }
.sty-left-count { color: var(--theme-text-secondary); font-size: var(--wf-text-sm); font-weight: 600; white-space: nowrap; }
.sty-left-biggest { margin: 4px 0 0; color: var(--theme-text-secondary); font-size: var(--wf-text-sm); }
.sty-left-list { margin: 10px 0 0; padding: 0; list-style: none; }
.sty-left-list > li { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; padding: 7px 0; border-top: 1px solid var(--wf-line); font-size: var(--wf-text-sm); }
.sty-left-nums { display: inline-flex; flex-wrap: wrap; gap: 4px 12px; font-variant-numeric: tabular-nums; }

/* ---- The mix of a significant moment ---- */
.sty-mix { min-width: 0; padding: 14px 18px; }
.sty-mix-title { margin: 0 0 6px; color: var(--theme-text-emphasis); font-size: var(--wf-text-h3); font-weight: 650; overflow-wrap: anywhere; }
.sty-mix-list { margin: 0; padding: 0; list-style: none; }
.sty-mix-list > li { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; padding: 6px 0; border-top: 1px solid var(--wf-line); font-size: var(--wf-text-sm); }
.sty-mix-name { min-width: 0; color: var(--theme-text); overflow-wrap: anywhere; }
.sty-mix-nums { display: inline-flex; gap: 10px; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---- The customers by channel ---- */
.sty-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.sty-chip { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px; border: 1px solid var(--wf-line); border-radius: var(--wf-radius-pill); background: var(--wf-card); color: var(--theme-text-secondary); font-size: var(--wf-text-sm); }
.sty-chip > b { color: var(--theme-text-emphasis); font-variant-numeric: tabular-nums; }

/* ---- The paths people took (the journey - phase 1b) ---- */
.sty-paths { padding: 12px 16px; min-width: 0; }
.sty-paths-title { margin: 0 0 8px; color: var(--theme-text-secondary); font-size: var(--wf-text-sm); font-weight: 600; }
.sty-paths-list { margin: 0; padding: 0 0 0 20px; }
.sty-paths-list > li { padding: 4px 0; color: var(--theme-text); font-size: var(--wf-text-sm); }
/* The li stays a list-item so the order is drawn and read; the row inside it is the flex. */
.sty-paths-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; }
.sty-paths-path { min-width: 0; overflow-wrap: anywhere; }
.sty-paths-figure { color: var(--theme-text-emphasis); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---- Trends, goals, what to try next ---- */
.sty-trends { margin: 0; padding: 0; list-style: none; }
.sty-trend { display: flex; align-items: baseline; gap: 8px; padding: 6px 0; color: var(--theme-text); font-size: var(--wf-text-sm); }
.sty-trend > .bi { color: var(--theme-text-muted); }
.sty-trend.is-rising > .bi,
.sty-trend.is-new > .bi { color: var(--wf-primary-ink); }
.sty-goals { display: grid; gap: 16px; min-width: 0; }
.sty-next { display: flex; flex-direction: column; gap: 8px; margin: 0; padding-left: 22px; }
.sty-next > li { padding-left: 4px; color: var(--theme-text); font-size: var(--wf-text-sm); line-height: 1.5; }
.sty-next > li > .btn { margin-left: 8px; vertical-align: baseline; }

/* ---- How we count ---- */
.sty-howwecount > details > summary { cursor: pointer; list-style-position: outside; }
.sty-howwecount > details > summary > .sty-chapter-title { display: inline; }
.sty-defs { margin: 10px 0 0; padding-left: 20px; color: var(--theme-text-secondary); font-size: var(--wf-text-sm); line-height: 1.5; }

/* ---- States: made, failed, first story, skeletons ---- */
.sty-made { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 14px 18px; }
.sty-made-words { flex: 1 1 18rem; min-width: 0; }
.sty-made-title { margin: 0; color: var(--theme-text-emphasis); font-weight: 650; overflow-wrap: anywhere; }
.sty-made-pdf { margin: 2px 0 0; color: var(--theme-text-secondary); font-size: var(--wf-text-sm); }
.sty-failed { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 14px; padding: 16px 18px; color: var(--theme-text-secondary); }
.sty-failed > p { flex: 1 1 16rem; min-width: 0; margin: 0; }
.sty-first { min-width: 0; }
.sty-first-list { display: flex; flex-direction: column; gap: 6px; margin: 0; padding-left: 20px; text-align: left; font-size: var(--wf-text-sm); }
.sty-skel-kpi { height: 4.5rem; }
.sty-skel-rows { height: 10rem; margin: 16px; }

/* ---- Books ---- */
.sty-books th,
.sty-books td { vertical-align: middle; }
.sty-mono { font-family: var(--theme-font-mono); font-size: var(--wf-text-sm); }
.sty-actions-col { text-align: right; white-space: nowrap; }
.sty-actions-col > .sty-row-note { white-space: normal; }
.sty-more { align-self: flex-start; }

/* ---- Send now ---- */
.sty-dialog { max-width: 36rem; }
.sty-dialog-lead { margin: 0 0 12px; color: var(--theme-text-secondary); font-size: var(--wf-text-sm); }
.sty-field { min-width: 0; margin: 0 0 14px; padding: 0; border: 0; }
.sty-field > legend { float: none; width: auto; padding: 0; font-size: 14px; }
.sty-field-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.sty-field-hint { margin-top: 2px; color: var(--theme-text-muted); font-size: var(--wf-text-xs); }
.sty-checks { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.sty-check { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: var(--wf-text-sm); }
.sty-people { display: flex; flex-direction: column; gap: 4px; max-height: 12rem; overflow-y: auto; padding: 6px 8px; border: 1px solid var(--wf-line); border-radius: var(--wf-radius-md); }
.sty-dialog-problem { margin: 8px 0 0; color: var(--wf-danger-ink); font-size: var(--wf-text-sm); }
.sty-dialog-said { margin: 8px 0 0; color: var(--wf-success-ink); font-size: var(--wf-text-sm); }
.sty-deliveries { margin-top: 10px; }
.sty-deliveries > caption { caption-side: top; padding: 0 0 6px; color: var(--theme-text-secondary); font-size: var(--wf-text-xs); font-weight: 650; }

@media (max-width: 640px) {
    .sty-asof { margin-left: 0; }
    .sty-cover { padding: 18px 16px 16px; }
    .sty-cover-title { font-size: var(--wf-text-h2); }
    .sty-status,
    .sty-made,
    .sty-failed,
    .sty-left,
    .sty-mix { padding: 12px 16px; }
    .sty-table th,
    .sty-table td { padding: 8px 10px; }
    .sty-actions-col { white-space: normal; }
}

/* THE NUMBERS MENU (2026-10-15) - a book's rows as a file, beside Download. */
.sty-data-menu { position: relative; display: inline-block; }
.sty-data-list { min-width: 14rem; }
