/* ============================================================================
   cli.css — the CLI page (#cli-section in app.html), a page like Portfolio
   and Referrals. It uses the page system (.v2-page-head, .v2-panel,
   .v2-panel-head) and the app's tokens. Every rule is scoped to #cli-section,
   so nothing here reaches another page. Sky marks ONLY the parts the reader
   must replace.
   ========================================================================== */
#cli-section {
    --cl-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    padding: 32px 0 80px;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-primary);
}
#cli-section .cl-wrap { max-width: 1160px; margin: 0 auto; padding: 0 20px; }
@media (min-width: 1680px) {
    #cli-section .cl-wrap { max-width: 1440px; }
}

#cli-section a { color: var(--text-primary); text-decoration: underline; text-decoration-color: rgba(255, 255, 255, .25); text-underline-offset: 3px; }
#cli-section a:hover { text-decoration-color: var(--text-primary); }
#cli-section code { font-family: var(--cl-mono); color: inherit; overflow-wrap: anywhere; }
#cli-section button { font-family: var(--sans); }
#cli-section button:focus-visible,
#cli-section input:focus-visible,
#cli-section a:focus-visible { outline: 2px solid var(--v2-sky); outline-offset: 2px; }

/* ---- the step rail: pinned on the left, panels on the right ---- */
#cli-section .cl-railed { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 28px; align-items: start; }
/* the steps and the three facts stay in view; a short window scrolls this column */
#cli-section .cl-side {
    position: sticky;
    top: 69px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: calc(100vh - 69px - 44px);
    overflow-y: auto;
    scrollbar-width: none;
}
#cli-section .cl-side::-webkit-scrollbar { display: none; }
#cli-section .cl-rail { display: flex; flex-direction: column; gap: 2px; }
#cli-section .cl-rail button {
    padding: 8px 10px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    text-align: left;
    white-space: nowrap;
    cursor: pointer;
}
#cli-section .cl-rail button:hover { color: var(--text-primary); }
#cli-section .cl-rail button[aria-current="true"] { background: var(--card-bg); color: var(--text-primary); font-weight: 600; }
#cli-section .cl-rail-col { min-width: 0; }
#cli-section .cl-rail-col > section { scroll-margin-top: 69px; }

/* ---- the agent prompt ---- */
#cli-section .cl-prompt-wrap { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
#cli-section .cl-prompt-box { position: relative; width: 100%; }
#cli-section .cl-prompt-box .cl-btn { position: absolute; top: 8px; right: 8px; }
#cli-section .cl-prompt {
    margin: 0;
    padding: 14px 48px 14px 16px;
    background: var(--panel-sunken);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.65;
    white-space: pre-wrap;
}
/* closed: the first four lines, fading out. The copy icon still copies all of it. */
#cli-section .cl-prompt-box:not(.is-open) .cl-prompt {
    max-height: 114px;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent);
    mask-image: linear-gradient(to bottom, #000 55%, transparent);
}
/* the button family, with an arrow that turns when the prompt opens */
#cli-section .cl-prompt-more {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 12px;
    border: 0;
    border-radius: 6px;
    background: var(--v2-chip);
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
}
#cli-section .cl-prompt-more:hover { background: var(--v2-chip-hover); }
#cli-section .cl-prompt-more i { font-size: 11px; }
#cli-section .cl-prompt-more[aria-expanded="true"] i { transform: rotate(180deg); }
#cli-section .cl-nb { white-space: nowrap; }
#cli-section .cl-prompt code { font-family: var(--cl-mono); color: inherit; overflow-wrap: anywhere; }

/* ---- the top: the line under the title, then the three facts ---- */
#cli-section .cl-tagline { margin: -8px 0 16px; font-size: 14px; color: var(--text-secondary); }
/* desktop: an open list under the steps, no box, lined up with the step names */
#cli-section .cl-facts {
    margin: 0;
    padding: 20px 10px 0;
    list-style: none;
    display: flex;
    flex: none;
    flex-direction: column;
    gap: 20px;
    background: transparent !important;
    border-top: 1px solid var(--v2-hair) !important;
    border-radius: 0 !important;
}
#cli-section .cl-facts li { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
#cli-section .cl-fact-k { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-muted); }
/* the app's own stroke style (m-app.js icons): 24 grid, 1.75 stroke, round ends */
#cli-section .cl-fact-ico { flex: none; width: 16px; height: 16px; color: var(--text-secondary); fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
#cli-section .cl-fact-v { font-size: 13px; line-height: 1.55; color: var(--text-primary); min-width: 0; }

/* ---- a step: one panel, a 36px head, then its body ---- */
/* the sub-headers: 26 title > 17 panel > 14 row, so each level reads apart */
#cli-section .v2-panel-head { height: 52px; }
#cli-section h2.v2-panel-name { margin: 0; font-family: var(--v2-display); font-size: 17px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; }
#cli-section .v2-panel-head .v2-panel-r { font-size: 12px; font-weight: 500; color: var(--text-muted); }
#cli-section .cl-panel-body { padding: 16px 16px 20px; display: flex; flex-direction: column; gap: 20px; min-width: 0; }
#cli-section .cl-lead { margin: 0; font-size: 14px; color: var(--text-secondary); }

/* ---- the builder: the choices, then the lines under them ---- */
#cli-section .cl-builder {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}
#cli-section .cl-builder-col { min-width: 0; display: flex; flex-direction: column; gap: 20px; }
#cli-section .cl-builder-col + .cl-builder-col { padding-top: 20px; border-top: 1px solid var(--v2-hair); }
#cli-section .cl-field { display: flex; flex-direction: column; gap: 8px; margin: 0; }
#cli-section .cl-label { font-size: 12px; color: var(--text-muted); }

/* market chips: true pills; the chosen one is the white primary */
#cli-section .cl-chips { display: flex; flex-wrap: wrap; gap: 6px; }
#cli-section .cl-chips:empty { display: none; }
#cli-section .cl-chip {
    height: 32px;
    padding: 0 12px;
    border: 0;
    border-radius: 999px;
    background: var(--v2-chip-inset);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}
#cli-section .cl-chip:hover { background: var(--v2-chip); color: var(--text-primary); }
#cli-section .cl-chip[aria-checked="true"] { background: var(--v2-primary-bg); color: var(--v2-ink); }
/* while the market list loads: one neutral pill, not a guess */
#cli-section .cl-chips-status {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    background: var(--v2-chip-inset);
    color: var(--text-muted);
    font-size: 13px;
}
#cli-section .cl-chips-status[hidden] { display: none; }

/* the switcher: sunken track, dark chosen segment, never sky */
#cli-section .cl-seg-track {
    max-width: 560px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 2px;
    padding: 2px;
    background: var(--panel-sunken);
    border-radius: 7px;
}
#cli-section .cl-seg-track.is-two { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 280px; }
#cli-section .cl-field[hidden] { display: none; }
#cli-section .cl-seg {
    border: 0;
    border-radius: 5px;
    padding: 8px 4px;
    background: transparent;
    color: var(--text-primary);
    line-height: 1.3;
    text-align: center;
    cursor: pointer;
    min-width: 0;
}
#cli-section .cl-seg:hover { background: rgba(255, 255, 255, .04); }
#cli-section .cl-seg[aria-checked="true"] { background: var(--v2-chip); }
#cli-section .cl-seg b { display: block; font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
#cli-section .cl-seg small { display: block; font-size: 11px; color: var(--text-muted); }
#cli-section .cl-seg[aria-checked="true"] small { color: var(--text-secondary); }
/* a type with no orders for the chosen market */
#cli-section .cl-seg:disabled { cursor: default; color: var(--text-muted); }
#cli-section .cl-seg:disabled:hover { background: transparent; }
#cli-section .cl-seg .cl-seg-none[hidden] { display: none; }

/* the amount field */
#cli-section .cl-amount {
    max-width: 320px;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 12px;
    background: var(--panel-sunken);
    border-radius: 6px;
    cursor: pointer;
}
#cli-section .cl-amount input {
    all: unset;
    flex: 1;
    min-width: 0;
    font: 600 16px var(--sans);
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    cursor: pointer;
}
/* the field draws the one ring: revamp.css:7426 rings every input with !important */
#cli-section .cl-amount input:focus-visible { outline: none !important; }
#cli-section .cl-amount:focus-within { outline: 2px solid var(--v2-sky); outline-offset: 2px; }
#cli-section .cl-amount span { font-size: 13px; color: var(--text-muted); }

/* the generated lines */
/* numbered steps: a number in the left rail, a line joining it to the next step */
#cli-section .cl-lines { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 24px; counter-reset: cl-line; }
#cli-section .cl-line { position: relative; display: flex; flex-direction: column; gap: 8px; padding-left: 36px; min-width: 0; counter-increment: cl-line; }
#cli-section .cl-line[hidden] { display: none; }
#cli-section .cl-line::before {
    content: counter(cl-line);
    position: absolute;
    left: 0;
    top: 0;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--v2-chip);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
}
#cli-section .cl-line:has(+ .cl-line:not([hidden]))::after {
    content: "";
    position: absolute;
    left: 10.5px;
    top: 28px;
    bottom: -18px;
    width: 1px;
    background: var(--v2-hair);
}
#cli-section .cl-line-what { font-size: 13px; line-height: 22px; color: var(--text-muted); }
#cli-section .cl-line-what b { color: var(--text-secondary); font-weight: 600; }
#cli-section .cl-line-what code { color: var(--text-secondary); font-size: 13px; }
#cli-section .cl-cmd {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 9px 8px 9px 12px;
    background: var(--panel-sunken);
    border-radius: 6px;
}
#cli-section .cl-cmd code {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    line-height: 1.6;
    padding-top: 3px;
    color: var(--text-primary);
    white-space: normal;
    overflow-wrap: normal;
}
#cli-section .cl-cmd code .tok { white-space: nowrap; }
/* the typed amount breaks inside only when it cannot fit on a line */
#cli-section .cl-cmd code .tok.val { white-space: normal; overflow-wrap: anywhere; }
#cli-section .cl-cmd code .flag { color: var(--text-secondary); }
#cli-section .cl-cmd code .hole { color: var(--v2-sky); }

/* the button family: 30px, r6, chip tone */
#cli-section .cl-btn {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: var(--v2-chip);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
}
#cli-section .cl-btn:hover { background: var(--v2-chip-hover); }
#cli-section .cl-btn:active { transform: scale(.97); }
/* the browser refused the copy: words, because an icon cannot say what to do next */
#cli-section .cl-btn.is-text { width: auto; padding: 0 12px; font-size: 12px; font-weight: 500; }
#cli-section .cl-note { margin: 0; font-size: 13px; color: var(--text-muted); }
#cli-section .cl-note[hidden] { display: none; }
/* a warning the reader must see: the agent can reach the wallet file */
#cli-section .cl-note.is-warn { color: var(--text-secondary); }
#cli-section .cl-note .hole { color: var(--v2-sky); }
#cli-section .cl-note code { color: var(--text-secondary); }

/* ---- the setup rows: one under another ---- */
#cli-section .cl-steps { margin: 0; padding: 0; list-style: none; }
#cli-section .cl-step { display: flex; gap: 12px; padding: 18px 0; min-width: 0; }
#cli-section .cl-step:first-child { padding-top: 0; }
#cli-section .cl-step:last-child { padding-bottom: 0; }
#cli-section .cl-step + .cl-step { border-top: 1px solid var(--v2-hair); }
#cli-section .cl-step-n { width: 16px; flex: none; text-align: center; font-weight: 600; color: var(--text-muted); font-variant-numeric: tabular-nums; }
#cli-section .cl-step-n.is-done { color: var(--positive); }
#cli-section .cl-step-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
#cli-section .cl-step-body b { font-size: 14px; font-weight: 600; }
#cli-section .cl-step-body p { margin: 0; font-size: 14px; color: var(--text-secondary); }
#cli-section .cl-step-body .cl-sub { font-size: 13px; color: var(--text-muted); }
#cli-section .cl-step-body .cl-sub code,
#cli-section .cl-step-body p code { color: var(--text-primary); font-size: 13px; }

/* ---- the example row ---- */
#cli-section .cl-read { display: flex; flex-direction: column; gap: 10px; }
#cli-section .cl-table-wrap { overflow-x: auto; background: var(--panel-sunken); border-radius: 8px; }
#cli-section .cl-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--cl-mono);
    font-size: 12.5px;
    font-variant-numeric: tabular-nums;
}
#cli-section .cl-table th { text-align: left; font-weight: 500; color: var(--text-muted); padding: 12px 14px 8px; white-space: nowrap; }
#cli-section .cl-table th.is-marked { color: var(--v2-sky); }
#cli-section .cl-table td { padding: 10px 14px; color: var(--text-secondary); border-top: 1px solid var(--v2-hair); white-space: nowrap; }
#cli-section .cl-table td.is-marked { color: var(--text-primary); background: rgba(125, 211, 252, .08); }
#cli-section .cl-table td.is-marked span { color: var(--text-muted); }
#cli-section .cl-table td .cl-date { margin-left: 6px; font-size: 11px; }
#cli-section .cl-read-cap { margin: 0; font-size: 12px; color: var(--text-muted); }
/* only the tips for the chosen bet: two cards side by side, one column on a phone */
#cli-section .cl-tips { margin: 6px 0 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
#cli-section .cl-tip { display: flex; flex-direction: column; gap: 6px; padding: 14px; min-width: 0; border: 1px solid var(--v2-hair); border-radius: 8px; }
#cli-section .cl-tip-k { font-size: 14px; font-weight: 600; color: var(--text-primary); line-height: 1.5; }
#cli-section .cl-tips-more[hidden] { display: none; }
#cli-section .cl-tips-more summary { font-size: 13px; color: var(--text-secondary); cursor: pointer; width: fit-content; }
#cli-section .cl-tips-more summary:hover { color: var(--text-primary); }
#cli-section .cl-tips-more .cl-tips { margin-top: 12px; }
#cli-section .cl-tip-body { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-width: 0; }
#cli-section .cl-tip-body p { margin: 0; font-size: 14px; color: var(--text-secondary); }
#cli-section .cl-chipcode {
    max-width: 100%;
    font-size: 12.5px;
    line-height: 1.5;
    padding: 4px 10px;
    border-radius: 6px;
    background: var(--panel-sunken);
    color: var(--text-primary);
    overflow-wrap: anywhere;
}

/* ---- questions: native details, height animated by cli.js ---- */
#cli-section .cl-faq { margin: 0; padding: 0 16px; list-style: none; }
#cli-section .cl-faq li + li .cl-faq-item { border-top: 1px solid var(--v2-hair); }
#cli-section .cl-faq-q {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    list-style: none;
    border-radius: 6px;
}
#cli-section .cl-faq-q::-webkit-details-marker { display: none; }
#cli-section .cl-faq-q::marker { content: ""; }
#cli-section .cl-faq-q:hover .cl-chev { color: var(--text-primary); }
#cli-section .cl-faq-q:focus-visible { outline: 2px solid var(--v2-sky); outline-offset: -2px; }
#cli-section .cl-chev { flex: none; width: 16px; height: 16px; color: var(--text-muted); }
#cli-section .cl-faq-item[open] .cl-chev { transform: rotate(180deg); }
#cli-section .cl-faq-item.is-closing .cl-chev { transform: none; }
#cli-section .cl-faq-a { overflow: hidden; }
#cli-section .cl-faq-a p { margin: 0; padding: 0 32px 16px 0; font-size: 14px; color: var(--text-secondary); }
#cli-section .cl-faq-a code { color: var(--text-primary); font-size: 13px; white-space: nowrap; }

/* ---- the last line: the SDK link and the version ---- */
#cli-section .cl-foot {
    margin-top: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 24px;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--text-muted);
}
/* the version: a quiet pill that links to the npm page */
#cli-section .cl-ver,
#cli-section .cl-ver:hover {
    display: inline-flex;
    align-items: center;
    height: 26px;
    padding: 0 10px;
    border-radius: 999px;
    background: var(--v2-chip-inset);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
}
#cli-section .cl-ver:hover { background: var(--v2-chip); color: var(--text-primary); }

/* ---- a status line for the screen reader ---- */
#cli-section .cl-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- below the desktop: one column, 44px thumbs ---- */
@media (max-width: 991.98px) {
    #cli-section .cl-chip, #cli-section .cl-seg, #cli-section .cl-btn { position: relative; }
    #cli-section .cl-chip::before, #cli-section .cl-seg::before, #cli-section .cl-btn::before {
        content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 44px; transform: translateY(-50%);
    }
    #cli-section .cl-chip { height: 36px; padding: 0 14px; }
    #cli-section .cl-seg { padding: 10px 4px; min-height: 44px; }
    #cli-section .cl-btn { width: 36px; height: 36px; }
    #cli-section .cl-btn::before { left: -4px; right: -4px; }
    #cli-section .cl-amount { height: 44px; }

    /* phone: no step rail. One scroll: title, agent panel, facts, then the steps */
    #cli-section .cl-railed { display: flex; flex-direction: column; align-items: stretch; gap: 12px; }
    #cli-section .cl-side, #cli-section .cl-rail-col { display: contents; }
    #cli-section .cl-rail { display: none; }
    #cli-section .cl-rail-col > * { order: 3; margin-top: 0; }
    #cli-section .cl-rail-col > #cli-agent { order: 1; }
    /* the facts sit in a panel, name left and value right, so they stay short */
    #cli-section .cl-facts {
        order: 2;
        padding: 4px 16px;
        gap: 0;
        background: var(--card-bg) !important;
        border-top: 0 !important;
        border-radius: 8px !important;
    }
    #cli-section .cl-facts li { display: grid; grid-template-columns: 124px minmax(0, 1fr); gap: 12px; padding: 12px 0; }
    #cli-section .cl-facts li + li { border-top: 1px solid var(--v2-hair); }
    #cli-section .cl-prompt-more { height: 36px; position: relative; }
    #cli-section .cl-prompt-more::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 44px; transform: translateY(-50%); }
    #cli-section .cl-amount, #cli-section .cl-seg-track { max-width: none; }
    #cli-section .cl-table td .cl-date { display: block; margin: 2px 0 0; }
}
/* phones: the example row is a card, one column per line */
@media (max-width: 599.98px) {
    #cli-section .cl-table-wrap { overflow-x: visible; }
    #cli-section .cl-tips { grid-template-columns: minmax(0, 1fr); }
    #cli-section .cl-lines { gap: 20px; }
    #cli-section .cl-line { padding-left: 30px; }
    #cli-section .cl-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
    #cli-section .cl-table, #cli-section .cl-table tbody, #cli-section .cl-table tr, #cli-section .cl-table td { display: block; }
    #cli-section .cl-table td { position: relative; white-space: normal; overflow-wrap: break-word; border-top: 0; padding: 8px 14px 8px 102px; }
    #cli-section .cl-table tr td:first-child { padding-top: 12px; }
    #cli-section .cl-table tr td:last-child { padding-bottom: 12px; }
    #cli-section .cl-table td::before { content: attr(data-label); position: absolute; left: 14px; width: 76px; color: var(--text-muted); font-weight: 500; }
    #cli-section .cl-table td.is-marked::before { color: var(--v2-sky); }
    #cli-section .cl-table td span { white-space: nowrap; }

}
@media (max-width: 480px) {
    #cli-section .cl-seg-track { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    #cli-section .cl-faq-a p { padding-right: 0; }
}

@media (prefers-reduced-motion: no-preference) {
    #cli-section .cl-rail button, #cli-section .cl-chip, #cli-section .cl-seg, #cli-section .cl-btn, #cli-section .cl-ver { transition: background-color .12s ease, color .12s ease; }
    #cli-section .cl-chev { transition: transform .22s ease, color .12s ease; }
    #cli-section .cl-prompt-more i { transition: transform .2s ease; }
    #cli-section .cl-prompt-more { transition: background-color .12s ease; }
}
