/* The lever panel's own chrome, shared by every page that carries one.
 *
 * Two scripts render this markup: js/product-levers.js on the product pages,
 * and js/estate-policy.js on the property, construction-materials and mortgage
 * pages. Both emit the same pl- class names, so these rules lived in
 * css/product-policies.css and the property pages were quietly styled by a
 * file that belonged to the product pages. One session editing that file could
 * break five pages it had no test over, which is exactly what nearly happened.
 *
 * Only rules BOTH scripts really use belong here, checked against what each
 * one actually emits rather than against what either is assumed to need.
 * Anything one page alone renders -- the food pass-through lines, the yearly
 * bill, the farm-to-shelf connection note -- stays in that page's own
 * stylesheet.
 *
 * Shared between sessions: say so before changing it.
 */

.pl-panel {
  position: fixed;
  right: 1rem;
  bottom: 0;
  z-index: 60;
  width: min(24rem, calc(100vw - 2rem));
  max-height: min(80vh, 44rem);
  display: flex;
  flex-direction: column;
  background: var(--bm-white);
  border: 1px solid var(--bm-border-dark);
  border-bottom: 0;
  border-radius: var(--bm-radius) var(--bm-radius) 0 0;
  box-shadow: var(--bm-shadow);
  font-size: 0.88rem;
}
.pl-panel[hidden] { display: none; }
.pl-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--bm-border);
  background: var(--bm-subtle);
  border-radius: var(--bm-radius) var(--bm-radius) 0 0;
}
.pl-title { margin: 0; font-size: 0.95rem; font-weight: 700; }
.pl-min {
  flex: 0 0 auto;
  font-family: var(--bm-font);
  font-size: 0.8rem;
  font-weight: 700;
  height: 2rem;
  padding: 0 0.7rem;
  border: 1px solid var(--bm-accent);
  border-radius: var(--bm-radius);
  background: var(--bm-white);
  color: var(--bm-accent);
  cursor: pointer;
}
.pl-min:hover { background: var(--bm-accent); color: var(--bm-white); }
.pl-body {
  overflow-y: auto;
  padding: 0.75rem;
}
/* Minimised: the body is gone and the head alone sits on the bottom edge,
 * keeping the panel's own width rather than stretching across the window, so
 * it stays recognisably the same thing in the same corner. */
.pl-panel.is-min { max-height: none; }
.pl-panel.is-min .pl-body { display: none; }
.pl-lede { margin: 0 0 0.6rem; font-size: 0.82rem; color: var(--bm-muted); }
.pl-measured {
  margin: 0 0 0.75rem;
  padding: 0.5rem 0.6rem;
  background: var(--bm-subtle);
  border-left: 3px solid var(--bm-accent);
  border-radius: var(--bm-radius);
  font-size: 0.82rem;
}
.pl-measured a, .pl-source a { color: var(--bm-accent); }
.pl-lever { margin: 0 0 0.9rem; padding-bottom: 0.9rem; border-bottom: 1px solid var(--bm-border); }
.pl-lever:last-of-type { border-bottom: 0; }
.pl-lever label { display: block; font-size: 0.84rem; font-weight: 700; margin-bottom: 0.3rem; }
.pl-lever-row { display: flex; align-items: center; gap: 0.5rem; }
/* The folded import-tax notes. Collapsed, because they explain figures that
   decide what the levers can do rather than figures anybody sets here. */
.pl-notes {
  margin: 0 0 0.75rem;
  padding: 0.45rem 0.6rem;
  background: var(--bm-subtle);
  border: 1px solid var(--bm-border);
  border-radius: 6px;
}
.pl-notes > summary { cursor: pointer; font-size: 0.8rem; list-style: none; }
.pl-notes > summary::-webkit-details-marker { display: none; }
.pl-notes > summary::before {
  content: "\25B8";
  display: inline-block;
  width: 0.9em;
  color: var(--bm-light);
}
.pl-notes[open] > summary::before { content: "\25BE"; }
.pl-notes dl { margin: 0.5rem 0 0; }
.pl-notes dt { margin: 0.55rem 0 0; font-size: 0.78rem; font-weight: 700; }
.pl-notes dt:first-of-type { margin-top: 0; }
.pl-notes dd {
  margin: 0.15rem 0 0;
  font-size: 0.76rem;
  line-height: 1.45;
  color: var(--bm-muted);
}
/* What the lever actually is, between its name and its figure. Muted and a
   shade smaller than the name so it reads as explanation rather than as a
   second heading, and it sits above the box because it has to be read before
   the number means anything. */
.pl-means {
  margin: 0 0 0.45rem;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--bm-muted);
}
/* The field matches the height every field on this site uses, so the panel
 * does not introduce a second size. */
.pl-lever input[type="number"] {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--bm-font);
  font-size: 0.92rem;
  color: var(--bm-text);
  background: var(--bm-white);
  border: 1px solid var(--bm-border-dark);
  border-radius: var(--bm-radius);
  padding: 0 0.6rem;
  height: 2.4rem;
}
.pl-unit { flex: 0 0 auto; font-size: 0.78rem; color: var(--bm-muted); }
.pl-markers { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0.45rem 0 0; }
.pl-marker {
  font-family: var(--bm-mono);
  font-size: 0.76rem;
  height: 1.7rem;
  padding: 0 0.5rem;
  border: 1px solid var(--bm-border-dark);
  border-radius: 999px;
  background: var(--bm-white);
  color: var(--bm-text);
  cursor: pointer;
}
.pl-marker:hover { border-color: var(--bm-accent); color: var(--bm-accent); }
.pl-marker-key { margin: 0.35rem 0 0; font-size: 0.74rem; color: var(--bm-light); line-height: 1.5; }
.pl-note { margin: 0.4rem 0 0; font-size: 0.8rem; }
.pl-source { margin: 0.3rem 0 0; font-size: 0.74rem; color: var(--bm-light); }
.pl-results { margin: 0.4rem 0 0; }
.pl-results h4 { margin: 0 0 0.4rem; font-size: 0.9rem; }
.pl-result {
  margin: 0 0 0.6rem;
  padding: 0.6rem 0.7rem;
  background: var(--bm-subtle);
  border-radius: var(--bm-radius);
}
.pl-result p { margin: 0 0 0.35rem; font-size: 0.83rem; }
.pl-result p:last-child { margin-bottom: 0; }
.pl-result-name { font-weight: 700; }
.pl-caveat { color: var(--bm-muted); font-size: 0.78rem !important; }
.pl-nothing { margin: 0; font-size: 0.82rem; color: var(--bm-muted); }
.pl-foot { margin-top: 0.6rem; }
/* The budget effect, and saving a scenario. */
.pl-budget {
  border-top: 1px solid var(--bm-border);
  padding-top: 0.4rem;
  margin-top: 0.5rem !important;
  font-weight: 600;
}
.pl-nobudget {
  border-top: 1px solid var(--bm-border);
  padding-top: 0.4rem;
  margin-top: 0.5rem !important;
  color: var(--bm-muted);
  font-size: 0.8rem !important;
}
.pl-save-label { display: block; font-size: 0.84rem; font-weight: 700; margin: 0 0 0.3rem; }
.pl-save-row { display: flex; gap: 0.5rem; }
/* Field and button the same height as every other on this site. */
.pl-save-row input[type="text"] {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--bm-font);
  font-size: 0.92rem;
  color: var(--bm-text);
  background: var(--bm-white);
  border: 1px solid var(--bm-border-dark);
  border-radius: var(--bm-radius);
  padding: 0 0.6rem;
  height: 2.4rem;
}
.pl-save-note { margin: 0.4rem 0 0; font-size: 0.76rem; color: var(--bm-light); }
.pl-save-note a { color: var(--bm-accent); }
.pl-saved-count { margin: 0.35rem 0 0.6rem; font-size: 0.78rem; color: var(--bm-muted); min-height: 1rem; }
.pl-saved-count:empty { display: none; }

/* The responsive and dark-theme rules for the shared chrome.
 *
 * These were left behind by the first extraction, because they sit inside
 * @media blocks rather than standing on their own. A panel that is styled
 * everywhere except on a narrow screen is worse than one that is not styled
 * at all, so they are copied here too and must move together with the rules
 * above whenever either changes.
 */
@media (max-width: 560px) {
  .pl-panel { right: 0; left: 0; width: 100%; border-radius: 0; border-left: 0; border-right: 0; }
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .pl-min:hover { color: #0f172a; }
}

/* Moved from css/product-policies.css: both scripts render these,
 * so leaving them in one page's own stylesheet was the same coupling
 * this file exists to end. */
/* Room above it. "Put everything back" undoes every figure on the panel, and
   it was sitting flush against the save note because the saved-count paragraph
   directly above collapses to nothing until something has been saved. A
   destructive action should not touch the thing above it. */
#pl-reset {
  margin-top: 0.9rem;
  font-family: var(--bm-font);
  font-size: 0.82rem;
  font-weight: 700;
  height: 2.4rem;
  padding: 0 0.9rem;
  border: 1px solid var(--bm-border-dark);
  border-radius: var(--bm-radius);
  background: var(--bm-white);
  color: var(--bm-text);
  cursor: pointer;
}
#pl-reset:hover { border-color: var(--bm-accent); color: var(--bm-accent); }
#pl-save {
  flex: 0 0 auto;
  font-family: var(--bm-font);
  font-size: 0.86rem;
  font-weight: 700;
  height: 2.4rem;
  padding: 0 1rem;
  border: 1px solid var(--bm-accent);
  border-radius: var(--bm-radius);
  background: var(--bm-accent);
  color: var(--bm-white);
  cursor: pointer;
}
#pl-save:hover { background: var(--bm-accent-hover); border-color: var(--bm-accent-hover); }
