/* Leonardo Codex -- styles for every ::block (Story 3510, builder F5). Phone first.
   Colours fall back to literals so the blocks also look right on a page without codex.css. */

.cxb {
    --cxb-ink: var(--cx-ink, #111827);
    --cxb-ink-2: var(--cx-ink-2, #374151);
    --cxb-ink-3: var(--cx-ink-3, #6B7280);
    --cxb-line: var(--cx-line, #DDE1E8);
    --cxb-soft: var(--cx-line-soft, #EEF0F3);
    --cxb-accent: var(--cx-accent, #2563EB);
    --cxb-green: var(--cx-green, #15803D);
    --cxb-green-soft: var(--cx-green-soft, #DCFCE7);
    --cxb-amber: var(--cx-amber, #B45309);
    --cxb-amber-soft: var(--cx-amber-soft, #FEF3C7);
    --cxb-red: var(--cx-red, #B91C1C);
    --cxb-red-soft: var(--cx-red-soft, #FEE2E2);
    min-width: 0;
    max-width: 100%;
    color: var(--cxb-ink);
    font-size: 15px;
    line-height: 1.45;
}
.cxb *, .cxb *::before, .cxb *::after { box-sizing: border-box; }

/* ---- boxed blocks: one record, a checklist, steps, a rollup */
.cxb-story, .cxb-solution, .cxb-entity, .cxb-matter, .cxb-file, .cxb-research, .cxb-countdown,
.cxb-checklist, .cxb-tasks {
    border: 1px solid var(--cxb-line);
    border-radius: 8px;
    background: #FFFFFF;
    padding: 10px 12px;
}

/* ---- loading skeleton (the class pmd-loading is what print waits on) */
.cxb-skel { display: block; padding: 4px 0; }
.cxb-skel span {
    display: block; height: 10px; margin: 6px 0; border-radius: 5px;
    background: linear-gradient(90deg, #E5E7EB 25%, #F3F4F6 50%, #E5E7EB 75%);
    background-size: 200% 100%;
    animation: cxb-shimmer 1.2s linear infinite;
}
.cxb-skel span:first-child { width: 60%; }
.cxb-skel span:last-child { width: 35%; }
@keyframes cxb-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .cxb-skel span { animation: none; } }

/* ---- chips */
.cxb-chip {
    display: inline-block; vertical-align: baseline;
    padding: 1px 8px; border-radius: 999px; border: 1px solid transparent;
    font-size: 12px; line-height: 1.5; font-weight: 600; white-space: nowrap;
}
.cxb-quiet { background: #F3F4F6; color: var(--cxb-ink-3); border-color: #E5E7EB; font-weight: 500; }
.cxb-green { background: var(--cxb-green-soft); color: var(--cxb-green); }
.cxb-amber { background: var(--cxb-amber-soft); color: var(--cxb-amber); }
.cxb-red { background: var(--cxb-red-soft); color: var(--cxb-red); }
.cxb-blue { background: #DBEAFE; color: #1D4ED8; }
.cxb-purple { background: #EDE9FE; color: #6D28D9; }
.cxb-tint { background: #FFFFFF; }
.cxb-green-text, .cxb-yes { color: var(--cxb-green); font-weight: 600; }
.cxb-red-text { color: var(--cxb-red); font-weight: 600; }
.cxb-empty { color: var(--cxb-ink-3); font-size: 14px; padding: 2px 0; }
.cxb-meta, .cxb-count { color: var(--cxb-ink-3); font-size: 12.5px; font-weight: 400; }
.cxb-pre { white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---- links and buttons */
.cxb a { color: var(--cxb-accent); text-decoration: none; overflow-wrap: anywhere; }
.cxb a:hover { text-decoration: underline; }
.cxb-open { font-size: 13px; white-space: nowrap; }
.cxb-btn {
    display: inline-block; min-height: 32px; padding: 4px 12px;
    border: 1px solid var(--cxb-line); border-radius: 6px; background: #FFFFFF; color: var(--cxb-ink-2);
    font: inherit; font-size: 13px; cursor: pointer;
}
.cxb-btn:hover { background: #F9FAFB; }
.cxb button:focus-visible, .cxb a:focus-visible { outline: 2px solid var(--cxb-accent); outline-offset: 2px; }

/* ---- lists and cards */
.cxb-ul, .cxb-ol { margin: 0; padding-left: 20px; }
.cxb-ul .cxb-ul { margin-top: 2px; }
.cxb-li { margin: 3px 0; }
.cxb-excerpt { color: var(--cxb-ink-3); font-size: 13.5px; margin: 1px 0 4px; }
.cxb-cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr; gap: 8px; }
.cxb-card { border: 1px solid var(--cxb-line); border-radius: 8px; background: #FFFFFF; padding: 9px 11px; min-width: 0; }
.cxb-card-title { font-weight: 600; display: block; margin-bottom: 2px; }
@media (min-width: 700px) { .cxb-cards { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); } }

.cxb-card-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.cxb-kind { color: var(--cxb-ink-3); font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.cxb-title { font-weight: 600; overflow-wrap: anywhere; }
.cxb-card-head .cxb-open, .cxb-card-head .cxb-btn { margin-left: auto; }
.cxb-kv { margin-top: 4px; font-size: 14px; }
.cxb-k { color: var(--cxb-ink-3); font-size: 12.5px; margin-right: 4px; }
.cxb-body { margin-top: 6px; color: var(--cxb-ink-2); font-size: 14px; }
.cxb-img img { display: block; max-width: 100%; height: auto; margin-top: 8px; border-radius: 6px; }

/* ---- label cloud */
.cxb-cloud { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: baseline; }
.cxb-label { display: inline-block; padding: 2px 9px; border-radius: 999px; background: #EFF6FF; }
.cxb-label-1 { font-size: 13px; } .cxb-label-2 { font-size: 15px; } .cxb-label-3 { font-size: 17px; } .cxb-label-4 { font-size: 19px; font-weight: 600; }

/* ---- page tree */
.cxb-tree { list-style: none; margin: 0; padding-left: 18px; }
.cxb-tree-top { padding-left: 0; }
.cxb-tree li { margin: 2px 0; }
.cxb-tree li.is-current > a { font-weight: 700; color: var(--cxb-ink); }
.cxb-tree-root { font-weight: 600; margin-bottom: 2px; }
.cxb-twist, .cxb-twist-gap { display: inline-block; width: 28px; height: 28px; vertical-align: middle; }
.cxb-twist { border: 0; background: transparent; cursor: pointer; padding: 0; position: relative; }
.cxb-twist::before, .cxb-twist-mark::before {
    content: ""; display: inline-block; width: 0; height: 0;
    border-left: 6px solid var(--cxb-ink-3); border-top: 5px solid transparent; border-bottom: 5px solid transparent;
    transition: transform .12s;
}
.cxb-twist[aria-expanded="true"]::before, [aria-expanded="true"] > .cxb-twist-mark::before { transform: rotate(90deg); }

/* ---- tables: they scroll sideways inside their own wrapper, never the page */
.cxb-table-wrap { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--cxb-line); border-radius: 8px; background: #FFFFFF; }
.cxb-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.cxb-table th, .cxb-table td { padding: 7px 10px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--cxb-soft); }
.cxb-table tr:last-child td { border-bottom: 0; }
.cxb-table th { background: #F9FAFB; color: var(--cxb-ink-2); font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.cxb-table .cxb-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cxb-sort { border: 0; background: transparent; padding: 0; margin: 0; font: inherit; font-weight: 700; color: inherit; cursor: pointer; min-height: 28px; }
.cxb-sort-mark::after { content: ""; display: inline-block; margin-left: 5px; border: 4px solid transparent; vertical-align: middle; }
th[aria-sort="ascending"] .cxb-sort-mark::after { border-bottom-color: var(--cxb-ink-2); margin-bottom: 4px; }
th[aria-sort="descending"] .cxb-sort-mark::after { border-top-color: var(--cxb-ink-2); margin-top: 4px; }

/* ---- action and checklist rows */
.cxb-act { display: flex; align-items: flex-start; gap: 8px; padding: 5px 0; position: relative; }
.cxb-act-list > .cxb-act + .cxb-act { border-top: 1px solid var(--cxb-soft); }
.cxb-act-main { flex: 1 1 auto; min-width: 0; line-height: 1.6; }
.cxb-act-text { overflow-wrap: anywhere; }
/* done = green with a tick and a quieter (still readable) text; never struck through */
.cxb-act.is-done .cxb-act-text { color: #4B5563; }
.cxb-act.is-skipped .cxb-act-text { color: var(--cxb-ink-3); }
.cxb-note { display: block; color: var(--cxb-ink-3); font-size: 13px; }
.cxb-box {
    flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; margin-top: 1px; padding: 0;
    border: 2px solid #9CA3AF; border-radius: 6px; background: #FFFFFF; color: #FFFFFF;
    font-size: 15px; font-weight: 700; line-height: 1;
}
button.cxb-box { cursor: pointer; }
.cxb-box.is-on { background: var(--cxb-green); border-color: var(--cxb-green); }
.cxb-more { flex: 0 0 auto; width: 32px; height: 30px; border: 0; border-radius: 6px; background: transparent; color: var(--cxb-ink-3); font-size: 20px; line-height: 1; cursor: pointer; }
.cxb-more:hover { background: #F3F4F6; }
.cxb-action { margin: 0 0 2px; }
.cxb-act-group { margin-top: 8px; }
.cxb-act-group-head { font-weight: 600; font-size: 14px; margin: 6px 0 2px; }
.cxb-group-toggle { display: flex; align-items: center; gap: 6px; width: 100%; min-height: 34px; padding: 2px 0; border: 0; background: transparent; font: inherit; font-weight: 600; font-size: 14px; color: var(--cxb-ink); text-align: left; cursor: pointer; }
.cxb-tasks-head { font-weight: 600; font-size: 14px; }
.cxb-tasks-over { color: var(--cxb-red); }
.cxb-tasks-none { color: var(--cxb-ink-3); font-weight: 400; }
.cxb-menu { position: absolute; right: 0; top: 34px; z-index: 50; min-width: 170px; padding: 4px; border: 1px solid var(--cxb-line); border-radius: 8px; background: #FFFFFF; box-shadow: 0 8px 24px rgba(0, 0, 0, .16); }
.cxb-menu-item { display: block; width: 100%; min-height: 38px; padding: 6px 10px; border: 0; border-radius: 6px; background: transparent; font: inherit; text-align: left; cursor: pointer; }
.cxb-menu-item:hover { background: #F3F4F6; }
.cxb-menu-item.danger { color: var(--cxb-red); }

/* ---- progress */
.cxb-progress { display: flex; align-items: center; gap: 8px; margin: 6px 0 2px; }
.cxb-bar { flex: 1 1 auto; height: 8px; border-radius: 4px; background: #E5E7EB; overflow: hidden; }
.cxb-bar-fill { height: 100%; background: var(--cxb-accent); border-radius: 4px; }
.cxb-bar-fill.is-full { background: var(--cxb-green); }
.cxb-progress-text { flex: 0 0 auto; font-size: 12.5px; color: var(--cxb-ink-3); white-space: nowrap; }
.cxb-check-body { margin-top: 4px; }
.cxb-checklist > .cxb-btn { margin-top: 6px; }

/* ---- runbook steps */
.cxb-step-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.cxb-step { border: 1px solid var(--cxb-line); border-radius: 8px; background: #FFFFFF; padding: 9px 11px; min-width: 0; }
.cxb-step-head { display: flex; align-items: baseline; gap: 8px; }
.cxb-step-num { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 12px; background: #1F2937; color: #FFFFFF; font-size: 12.5px; font-weight: 700; }
.cxb-code-wrap { display: flex; align-items: flex-start; gap: 6px; margin-top: 6px; min-width: 0; }
.cxb-code { flex: 1 1 auto; min-width: 0; margin: 0; padding: 8px 10px; border-radius: 6px; background: #111827; color: #F9FAFB; font: 13px/1.45 Consolas, "Courier New", monospace; overflow-x: auto; white-space: pre; }
.cxb-copy { flex: 0 0 auto; }
.cxb-step-list + .cxb-btn { margin-top: 8px; }
.cxb-runs { margin-top: 10px; }

/* ---- quote, calendar */
.cxb-quote-box { margin: 0; padding: 6px 0 6px 14px; border-left: 4px solid var(--cxb-line); }
.cxb-quote-text { font-size: 16px; font-style: italic; color: var(--cxb-ink-2); }
.cxb-quote-by { margin-top: 4px; color: var(--cxb-ink-3); font-size: 13.5px; }
.cxb-cal { list-style: none; padding-left: 0; }
.cxb-cal-date { display: inline-block; min-width: 116px; font-variant-numeric: tabular-nums; color: var(--cxb-ink-2); font-size: 13.5px; font-weight: 600; }
.cxb-cal-date.is-today { color: var(--cxb-accent); }

/* ---- print: the static markup already has no buttons; keep the boxes from splitting */
.pmd-print .cxb-step, .pmd-print .cxb-card, .pmd-print .cxb-act { page-break-inside: avoid; }
.pmd-print .cxb-table-wrap { overflow: visible; }
