/* Power calculator: the chart app's Figure screen (app.css: .screen, .fig-head, .fig-grid, .view-tabs, .figwrap, the code
   view), with the calculator's own pieces below. Inputs and selects are styled by the UI kit. */
body.power { margin: 0; background: var(--bg); color: var(--ink); }
.power .brand { text-decoration: none; color: var(--ink); }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 12px; top: 12px; z-index: 10; background: var(--panel); padding: 8px 12px; }
.pw { display: flex; flex-direction: column; }
.pw .fig-head h1 { white-space: nowrap; }
@media (max-width: 1100px) { .pw { height: auto; } .pw .figwrap { min-height: 70vh; } }

/* Code tab: the frame takes the code colours, as in the app (#s3.show-code in app.css) */
.pw.show-code .view-tabs button.on { --tab-bg: var(--code-bar); color: var(--code-ink); } /* as the toolbar under it */
.pw.show-code .figwrap { border-top-left-radius: var(--radius); background: var(--code-bg); z-index: 1; }

/* settings panel */
.pw-side { padding: 14px 16px 18px; }
.designs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 6px 0 10px; }
.dz { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; text-align: left; padding: 7px 10px; height: auto; background: var(--panel); min-width: 0; }
.dz span { color: var(--muted); font-size: 11.5px; font-weight: 400; white-space: normal; }
.dz.on { border-color: var(--accent); background: var(--accent-soft); }
.demo-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0 0 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.demo-note { flex-basis: 100%; margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.btn.sm { padding: 4px 10px; font-size: 12.5px; }
.btn-ghost { border-color: var(--line); background: var(--panel); color: var(--ink); }
.btn-ghost:hover { border-color: var(--line-strong); background: var(--hover); color: var(--ink); }
.btn.on { border-color: var(--accent); background: var(--accent-soft); }
.linkbtn { background: none; border: 0; box-shadow: none; color: var(--accent); cursor: pointer; font: inherit; padding: 4px 2px; }
.help { width: 16px; height: 16px; border-radius: 50%; border: 0; background: var(--sunken); color: var(--muted); font-size: 11px; line-height: 1; cursor: pointer; margin-left: 6px; padding: 0; vertical-align: middle; box-shadow: none; display: inline-grid; place-items: center; }
.help:hover { color: var(--accent); background: var(--accent-soft); }
.pf { display: block; margin: 0 0 12px; }
.pf .pl { display: block; font-weight: 600; font-size: 12.5px; margin-bottom: 4px; }
.pf small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 3px; }
.pf input[type=text] { width: 100%; }
.row { display: flex; gap: 8px; align-items: center; }
.row input[type=text] { flex: 1; }
.unit { color: var(--muted); white-space: nowrap; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; flex-wrap: wrap; background: var(--panel); }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 5px 11px; font-size: 12.5px; color: var(--muted); }
.seg input:checked + span { background: var(--accent-soft); color: var(--accent); font-weight: 550; }
.seg input:focus-visible + span { box-shadow: var(--focus); }
.sec { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 4px; }
fieldset.grp { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 12px 2px; margin: 0 0 12px; }
fieldset.grp legend input { font-weight: 600; width: 12em; }
.gm { margin-bottom: 6px; }
.gm input:first-child { width: 9em; flex: 0 0 auto; }
.x { border: 0; background: none; box-shadow: none; color: var(--muted); cursor: pointer; font-size: 15px; }
.pnote { font-size: 12.5px; color: var(--muted); }
.pw-side textarea { width: 100%; font: 12px/1.5 var(--mono); color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; resize: vertical; }
.ck { display: flex; gap: 8px; align-items: center; font-size: 13px; margin: 6px 0 10px; }

/* result (the script's output) as a dashboard, scrolling inside the frame */
.pw-results { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 18px 20px 22px; }
.pw-results[hidden] { display: none; }
.pr { display: flex; flex-direction: column; gap: 14px; max-width: 1180px; }
.pr-head { padding: 14px 18px; border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--radius); background: var(--panel-2); }
.big { font-size: 34px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.big span { font-size: 16px; font-weight: 500; color: var(--muted); margin-left: 6px; letter-spacing: 0; }
.big.small { font-size: 20px; }
.pr-detail { margin-top: 4px; color: var(--muted); }
.loss { margin-top: 4px; font-weight: 600; }
.pr-effect { margin: 8px 0 0; }
/* the figures: each on white paper at the script's own size, side by side when they fit */
.pr-figs { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-start; }
.pr-figs figure { margin: 0; display: flex; flex-direction: column; gap: 6px; min-width: 0; max-width: 100%; }
.pr-figs figcaption { font-weight: 600; font-size: 12.5px; color: var(--muted); }
.plot { display: inline-block; width: max-content; max-width: 100%; min-height: 0; overflow-x: auto; background: #fff; /* (style.css's .plot has a 520 px minimum) */ border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px; color-scheme: light; }
.plot > .js-plotly-plot { min-height: 0 !important; }
.pr-card { padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); width: max-content; max-width: 100%; }
.pr-cap { font-weight: 600; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.pr-small { margin: 6px 0 0; font-size: 12.5px; }
.tw { overflow-x: auto; }
.results table { border-collapse: collapse; font-size: 12.5px; margin: 2px 0; }
.results th, .results td { border-bottom: 1px solid var(--line); padding: 4px 12px; text-align: right; }
.results th { color: var(--muted); font-weight: 550; }
.results th:first-child, .results td:first-child { text-align: left; padding-left: 0; }
/* the texts for the paper, side by side */
.pr-blocks { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; }
.blk { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px 12px; margin: 0; min-width: 0; }
.blk p { margin: 8px 0 0; line-height: 1.55; }
.bh { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.bh .btn { margin-left: auto; }
.blk pre { white-space: pre-wrap; font: 12px/1.5 var(--mono); margin: 8px 0 4px; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--code-bg); color: var(--code-ink); border: 1px solid var(--line); }
.note { margin: 0; font-size: 12.5px; color: var(--warn); background: var(--warn-soft); border-radius: var(--radius-sm); padding: 8px 12px; border-left: 3px solid var(--warn); }
.perr { color: var(--warn); font-weight: 600; } .pmsg { color: var(--muted); }
.pw .codeview[hidden] { display: none; }

dialog#help { max-width: 620px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--ink); padding: 20px 22px; box-shadow: var(--shadow-lg); }
dialog#help::backdrop { background: var(--scrim); }
dialog#help h2 { margin-top: 0; font-size: 17px; } dialog#help h3 { font-size: 14px; margin: 14px 0 4px; }
.badge { font-size: 11px; background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 1px 8px; vertical-align: middle; }
