/* Sheets Lab, fin.ejiapi.com/sheets: one lab for every finance API. Loaded after /mf/explorer/explorer.css (access switch, cards, chips). */
.lab-intro { margin: 0 0 18px; max-width: 74ch; }
.lab-count { font-size: 14px; font-weight: 500; letter-spacing: 0; margin-left: 6px; }

/* grid */
.lab-gridwrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.lab-grid { border-collapse: collapse; width: 100%; min-width: 640px; font-size: 14.5px; }
.lab-grid th { background: var(--bg); color: var(--muted); font-weight: 600; font-size: 12.5px; padding: 5px 8px; border: 1px solid var(--line); text-align: center; }
.lab-grid thead th { position: sticky; top: 0; }
.lab-grid tbody th { width: 34px; }
.lab-grid td { padding: 0; border: 1px solid var(--line); }
.ex .lab-grid td input[type=text] { width: 100%; min-width: 96px; font: inherit; font-size: 14.5px; padding: 7px 9px; border: 0; background: transparent; color: var(--ink); border-radius: 0; box-shadow: none; }
.ex .lab-grid td input[type=text]:focus { outline: 2px solid var(--accent); outline-offset: -2px; background: var(--accent-soft); }
.ex .lab-grid td input[type=text].num { text-align: right; font-variant-numeric: tabular-nums; }
.ex .lab-grid td input[type=text].err { color: var(--bad); background: color-mix(in srgb, var(--bad) 8%, transparent); font-weight: 600; }
.lab-gridstate { min-height: 22px; margin: 8px 0 0; font-size: 13.5px; color: var(--muted); }
.lab-gridstate.bad { color: var(--bad); }

/* portfolio form */
.lab-form { display: grid; grid-template-columns: minmax(220px, 2fr) 1fr 1fr 1.2fr auto; gap: 12px; align-items: end; }
.lab-form label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 4px; }
.lab-form input { width: 100%; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; }
.lab-fund { position: relative; }
.lab-fundres { list-style: none; margin: 4px 0 0; padding: 0; position: absolute; left: 0; right: 0; z-index: 6; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); max-height: 260px; overflow: auto; }
.lab-fundres:empty { display: none; }
.lab-fundres button { display: block; width: 100%; text-align: left; font: inherit; font-size: 14.5px; padding: 9px 12px; border: 0; background: none; color: var(--ink); cursor: pointer; }
.lab-fundres button:hover, .lab-fundres button:focus-visible { background: var(--accent-soft); }
.lab-fundres .state { padding: 10px 12px; color: var(--muted); font-size: 14px; }
@media (max-width: 860px) { .lab-form { grid-template-columns: 1fr 1fr; } .lab-fund { grid-column: 1 / -1; } .lab-form button { grid-column: 1 / -1; } }
.lab-importbox textarea { width: 100%; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 13.5px; margin: 6px 0; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); }

/* results */
.lab-out { margin-top: 18px; }
.lab-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 14px; }
.lab-tile { padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.lab-tile .muted { font-size: 12.5px; }
.lab-tile .v { font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; margin-top: 2px; }
.lab-out .hold td.n { color: var(--ink); }  /* the site's .n class is the orange of code samples */
.lab-tile .v.pos, .lab-out .hold td.n.pos { color: var(--good); }
.lab-tile .v.neg, .lab-out .hold td.n.neg { color: var(--bad); }
.lab-out .hold th.n { color: var(--muted); }
.lab-out .hold th.n, .lab-out .hold td.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lab-alloc { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin: 18px 0 6px; }
@media (max-width: 760px) { .lab-alloc { grid-template-columns: 1fr; } }
.lab-bars h4 { margin: 0 0 8px; font-size: 14px; color: var(--muted); font-weight: 600; }
.lab-bars .bar { display: grid; grid-template-columns: minmax(90px, 1.2fr) 2fr 52px; gap: 8px; align-items: center; font-size: 13.5px; margin: 5px 0; }
.lab-bars .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lab-bars .track { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.lab-bars .fill { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.lab-bars .pc { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.lab-tx { margin-top: 14px; }
.lab-tx summary { cursor: pointer; font-weight: 600; font-size: 14.5px; }
.lab-tx ul { list-style: none; margin: 8px 0 0; padding: 0; }
.lab-tx li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px; }

/* script */
.lab-funcs label, #lab-funcs label { cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.lab-steps { margin: 16px 0 8px; padding-left: 22px; }
.lab-steps li { margin: 4px 0; }
.lab-net { min-height: 20px; margin: 0 0 12px; color: var(--warn); }
.lab-include { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; margin: 4px 0 12px; cursor: pointer; }
.lab-include input:disabled + * { opacity: .6; }

/* function reference and script picker, one group per finance API */
.lab-ref { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px 28px; }
.lab-refgroup h4 { margin: 0 0 6px; font-size: 15px; }
.lab-refgroup dl { margin: 0; }
.lab-refgroup dt { margin-top: 10px; }
.lab-refgroup dt code { font-size: 13px; white-space: normal; }
.lab-refgroup dd { margin: 3px 0 0; font-size: 14px; color: var(--muted); }
.lab-funcs { display: grid; gap: 10px; margin: 10px 0 4px; }
.lab-funcrow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.lab-funcrow .lead { font-size: 13px; color: var(--muted); min-width: 96px; font-weight: 600; }
/* CAS workbook card */
.lab-casform { display: grid; grid-template-columns: minmax(220px, 2fr) 1fr auto; gap: 12px; align-items: end; margin-top: 14px; }
.lab-casform label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 4px; }
.lab-casform input { width: 100%; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; }
@media (max-width: 760px) { .lab-casform { grid-template-columns: 1fr; } }
#cas-build h4 { margin: 18px 0 6px; }

/* Stitch Sheets Lab screen: grey grid head and row numbers in mono, the first example chip filled, a soft card per step */
.lab-grid th { background: var(--surface-2); font: 600 11.5px/1.4 var(--mono); letter-spacing: .06em; }
.lab-grid tbody th { color: var(--muted); }
.lab-card > h3 { display: flex; align-items: center; gap: 10px; font-size: 19px; }
.lab-card > h3::before { content: ""; width: 4px; height: 18px; border-radius: 2px; background: var(--accent); }
#lab-examples .chip { display: inline-flex; align-items: center; gap: 6px; }
#lab-examples .chip:first-of-type { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.lab-gridstate { font-family: var(--mono); font-size: 12.5px; }
.lab-tile { background: var(--surface); box-shadow: 0 1px 2px rgba(17,21,28,.03); }
.lab-tile .muted { font: 600 11px/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; }

/* the page map at the top: two ways, one script each */
.lab-howto { border-left: 4px solid var(--accent, #433fcf); }
.lab-howto h3 { margin-top: 0; }

/* ---------- goal stepper (Stitch screen be12dca2, 2026-11-21): pick one goal, see only its numbered steps ---------- */
.goal-off { display: none !important; }
.lab-goals { border: 0; margin: 6px 0 4px; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.lab-goals legend { padding: 0; margin-bottom: 10px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.lab-goal { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.lab-goal:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.lab-goal input { position: absolute; opacity: 0; pointer-events: none; }
.lab-goal .ico { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 4px; }
.lab-goal .ico .i { width: 18px; height: 18px; }
.lab-goal .tick { position: absolute; top: 14px; right: 14px; width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--line); display: grid; place-items: center; color: transparent; }
.lab-goal .tick .i { width: 12px; height: 12px; }
.lab-goal strong { font-size: 16px; }
.lab-goal .muted { font-size: 13.5px; line-height: 1.4; }
.lab-goal:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.lab-goal:has(input:checked) .tick { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.lab-goal:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 860px) { .lab-goals { grid-template-columns: 1fr; } }

/* the numbered steps, the script preview and the formula list are shared by every Sheets Lab page: /assets/sheets/sheets.css */

/* formula builder: many fields of a live answer, for one or several codes, as a table of =EJI(path, field) formulas */
.lab-bintro { margin: 0 0 10px !important; }
.lab-bform { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.lab-bparams { display: contents; }
.lab-bparam { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; }
.lab-bparam select, .lab-bparam input, .lab-bpathbox input, .lab-bhead input { font: inherit; font-weight: 400; font-size: 14px; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; }
.lab-bparam select { min-width: 250px; }
.lab-bparam input { width: 150px; }
.lab-bparam.many input { width: 300px; }
.lab-bpathbox { margin-top: 8px; font-size: 13px; }
.lab-bpathbox summary { cursor: pointer; color: var(--muted); }
.lab-bpathbox input { display: block; width: 100%; margin-top: 6px; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 13px; }
.lab-bhead { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 6px; font-size: 14px; }
.lab-bhead input { margin-left: auto; width: 220px; padding: 6px 10px; }
.lab-bfields { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px; margin-top: 8px; max-height: 300px; overflow: auto; padding: 2px; }
.lab-bfields:empty { display: none; }
.lab-bfield { display: flex; align-items: center; gap: 8px; text-align: left; font: inherit; font-size: 13.5px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); cursor: pointer; min-width: 0; }
.lab-bfield:hover, .lab-bfield:focus-visible { border-color: var(--accent); }
.lab-bfield .box { flex: none; width: 16px; height: 16px; border-radius: 4px; border: 1.5px solid var(--line); display: grid; place-items: center; }
.lab-bfield.on { border-color: var(--accent); background: var(--accent-soft); }
.lab-bfield.on .box { background: var(--accent); border-color: var(--accent); }
.lab-bfield.on .box::after { content: ""; width: 8px; height: 4px; border: 2px solid var(--accent-ink); border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.lab-bfield code { font-size: 12.5px; background: none; padding: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 auto; min-width: 0; }
.lab-bfield .v { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; flex: 0 1 auto; }
.lab-bpick { margin-top: 12px; padding: 12px 14px; border-radius: 10px; background: var(--accent-soft); }
.lab-bprevwrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.lab-bprev { border-collapse: collapse; width: 100%; font-size: 13px; }
.lab-bprev th, .lab-bprev td { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.lab-bprev th { font-weight: 600; color: var(--muted); background: var(--bg); text-transform: none; letter-spacing: 0; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; }
.lab-bprev td.key { font-weight: 600; }
.lab-bprev td.later { color: var(--muted); }
.lab-bprev td.bad { color: var(--bad); }
.lab-bprev tr:last-child td { border-bottom: 0; }
.lab-bpick .muted { font-size: 13px; margin: 8px 0 0; }
.lab-bpick .lab-actions { margin-top: 8px; }
.lab-bpick .hint { font-size: 12.5px; }
