/* ============================================================================
   PM PLANNING PREP TOOL — STYLES
   ----------------------------------------------------------------------------
   Built from design_handoff_cmm_pm_planning_prep_102026. This file is also
   the template for every CMM tool page: the header, the graph-paper ground,
   the work column, the right panel, the storage strip. A later tool keeps
   all of it and swaps what sits inside .work.

   It loads AFTER /styles.css, which supplies the palette, the fonts, the
   site footer and the narrow-screen menu. Only what the site file does not
   already say is written here.
============================================================================ */

:root {
  /* Tool-only colours. Everything else comes from /styles.css. */
  --alert:     #A4372A;  /* the one red: over-length titles, a bad date */
  --muted:     #8A938F;  /* dashed outlines, placeholder text, unset boxes */
  --lake-off:  #A6B6D9;  /* a Lake button that cannot be pressed yet */
  --caret-off: #A6B0AC;  /* the sort caret that is not the chosen one */
  --below-cut: #FCFBF8;  /* rows under the cut line */
  --cycle-bg:  #F4EFE6;  /* the cycle form's ground */
  --lake-deep: #1D4ED8;  /* Lake hover */
  --field:     rgba(14, 61, 50, 0.3);
}

/* The site hides only the elements it names. A tool draws most of itself
   from script, so it needs the general rule. */
[hidden] { display: none !important; }

/* --- The ground ---------------------------------------------------------
   Graph paper: a 120px major grid over a 24px minor one, fixed so it stays
   still while the page scrolls. The work column carries its own Linen
   backing plus a 28px ring of it, so the grid only ever shows in the
   margins. The header and the footers are solid. */
body.tool-body {
  background-color: var(--linen);
  background-image:
    linear-gradient(rgba(14, 61, 50, .075) 1px, transparent 1px),
    linear-gradient(90deg, rgba(14, 61, 50, .075) 1px, transparent 1px),
    linear-gradient(rgba(14, 61, 50, .04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(14, 61, 50, .04) 1px, transparent 1px);
  background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px;
  background-position: -1px -1px;
  background-attachment: fixed;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ------------------------------------------------------------ The header */

.tool-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 20px;
  min-height: 76px;
  padding: 10px 28px;
  /* White, like every other page's header. The ground below it stays
     Linen — that is the one place the graph paper needs it. */
  background: var(--page-bg);
  border-bottom: 1px solid var(--hairline-card);
}
.tool-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  flex-shrink: 0;
  color: inherit;
}
.tool-brand:hover { text-decoration: none; }
.tool-brand img { height: 36px; width: auto; display: block; }
.tool-byline { font-size: 11.5px; line-height: 1.3; color: var(--moss); }
.tool-divider { width: 1px; height: 36px; background: rgba(14, 61, 50, 0.2); }
.tool-name {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 20.7px;
  letter-spacing: -0.01em;
  color: var(--pine);
}
/* The primary call on every tool page. Amber on Linen, Pine text. */
.tool-feedback {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 20px;
  background: var(--amber);
  color: var(--pine);
  font-weight: 600;
  font-size: 14.5px;
}
.tool-feedback:hover { background: #C98C1C; color: var(--pine); text-decoration: none; }
.tool-nav {
  margin-left: auto;
  align-self: center;
  gap: 4px 28px;
}
.tool-nav .nav-link { color: var(--charcoal); }
.tool-nav .nav-link:hover { color: var(--lake); text-decoration: underline; }

/* Below the wrap point the site's hamburger takes over. The feedback CTA
   goes with the links — it leads the panel instead. */
@media (max-width: 819px) {
  .tool-header > .tool-feedback { display: none; }
  /* The divider separates the lockup from the tool name on one line. Once
     the name drops to a line of its own there is nothing to divide. */
  .tool-divider { display: none; }
  .tool-brand { flex: 1 1 100%; }
  .tool-panel-nav { width: 100%; margin: 0 -28px -10px; padding: 8px 28px 20px; }
  .tool-panel-feedback {
    margin-bottom: 8px;
    padding: 0 18px;
    background: var(--amber);
    color: var(--pine);
    font-weight: 600;
    border-bottom: 0;
  }
  .tool-panel-feedback:hover { background: #C98C1C; color: var(--pine); text-decoration: none; }
}

/* --------------------------------------------------- Columns and column */

.tool-grid {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}
/* With a panel open the work column centres in what is left. */
.tool-grid.is-split { grid-template-columns: minmax(0, 1fr) 440px; }

.tool-main { min-width: 0; padding: 32px 28px 48px; }
.work {
  max-width: 820px;
  margin: 0 auto;
  background: var(--linen);
  box-shadow: 0 0 0 28px var(--linen);
  display: flex;
  flex-direction: column;
  gap: 22px;
}
/* The way back to the notebook, in the same shape as the notebook's own
   "All lab work" link: 44px tall so it is a real target, and sitting above
   the scenario rather than inside the header, which belongs to the site. */
.work-back {
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  min-height: 44px;
  margin-bottom: -10px;
  font-weight: 500;
  font-size: 14.5px;
}
/* The standing explanation of the page, above the scenario. Measured at
   62ch like the site's running text, so it reads as prose rather than
   filling the 820px work column. */
.work-intro {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 62ch;
  margin-bottom: -4px;
}
.work-intro h2 {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: clamp(22px, 2.4vw, 28px);
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--pine);
  margin: 0;
}
.work-intro p {
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--charcoal);
  margin: 0;
  text-wrap: auto;
}
.work-noscript {
  padding: 16px 18px;
  background: var(--white);
  border: 1px solid var(--hairline-card);
  font-size: 14.5px;
  line-height: 1.55;
}
#work-head, #work-body { display: flex; flex-direction: column; gap: 22px; }

/* ----------------------------------------------------- Shared furniture */

.linkish {
  border: 0;
  background: transparent;
  padding: 4px 0;
  color: var(--lake);
  font-family: inherit;
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.linkish:hover { color: var(--pine); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  font-family: inherit;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}
.btn-lake { background: var(--lake); color: var(--white); }
.btn-lake:hover { background: var(--lake-deep); }
.btn-lake[disabled] { background: var(--lake-off); cursor: not-allowed; }
.btn-outline {
  border: 1.5px solid var(--pine);
  background: transparent;
  color: var(--pine);
  font-weight: 500;
}
.btn-outline:hover { background: var(--linen-shade); }
.btn-outline[disabled] {
  border-color: rgba(14, 61, 50, 0.2);
  color: var(--muted);
  cursor: not-allowed;
  background: transparent;
}
.btn-lg { height: 44px; padding: 0 22px; }

.field {
  box-sizing: border-box;
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--field);
  background: var(--white);
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--pine);
  outline-color: var(--lake);
}
.field-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--moss);
}
.textarea {
  box-sizing: border-box;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--field);
  background: var(--white);
  resize: vertical;
  font-family: var(--font-body);
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--charcoal);
  outline-color: var(--lake);
}
.mono { font-family: "IBM Plex Mono", monospace; }
.alert { color: var(--alert); font-weight: 600; font-size: 13px; margin: 0; }

/* ------------------------------------------------- Scenario and cycle */

.eyebrow-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
  font-weight: 600;
  color: var(--moss);
}
.eyebrow-pipe { color: rgba(14, 61, 50, 0.35); font-weight: 400; }
.cycle-label { color: var(--pine); }
/* Amber, because the explainer is the thing a first-time visitor needs and
   an outlined button beside a wall of copy disappeared. Amber ground with
   Pine text is the site's pairing on a light band — the same as the
   header's Share your feedback — and no Amber text, which is the rule. */
.btn.help-btn {
  margin-left: auto;
  border: 0;
  background: var(--amber);
  color: var(--pine);
  font-weight: 600;
}
.btn.help-btn:hover { background: #C98C1C; }

.cycle-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  background: var(--cycle-bg);
  border: 1px solid rgba(14, 61, 50, 0.15);
}
.cycle-fields { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.cycle-fields .field-label:last-child { flex: 1 1 200px; }
.cycle-fields .field-label:last-child .field { width: 100%; }
.cycle-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.cycle-actions .linkish { margin-left: auto; }

.scenario-form { display: flex; flex-direction: column; gap: 8px; }
.scenario-row { display: flex; gap: 8px; flex-wrap: wrap; }
.scenario-input {
  flex: 1 1 280px;
  min-width: 0;
  box-sizing: border-box;
  height: 52px;
  padding: 0 14px;
  border: 1px solid var(--field);
  background: var(--white);
  font-family: var(--font-head);
  font-weight: 500;
  font-size: 22px;
  color: var(--pine);
  outline-color: var(--lake);
}
.scenario-row .btn { height: 52px; padding: 0 24px; font-size: 15px; }
.scenario-title { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.scenario-title h1 {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: var(--pine);
}
.scenario-title .linkish { font-size: 14px; padding: 6px 0; }

/* ----------------------------------------------------- The opening screen */

.lede { font-size: 14.5px; line-height: 1.55; color: var(--charcoal); margin: 0 0 -10px; }
/* auto, not the site's `pretty`: pretty pulls words back off the last line,
   and here that stops the first sentence running the width of the box. */
.import-intro { text-wrap: auto; }
.import-intro .linkish { font-size: inherit; padding: 0; }
/* Lake, but not a link — it names the control in the storage strip. */
.lake-text { color: var(--lake); }
.import-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 64px 24px 72px;
  background: var(--white);
  border: 1px solid var(--hairline-card);
  text-align: center;
}
.import-box-title { font-family: var(--font-head); font-weight: 500; font-size: 22px; color: var(--pine); }
.import-box-body { max-width: 46ch; font-size: 14.5px; line-height: 1.55; color: var(--moss); }
.import-box .btn { height: 48px; padding: 0 26px; font-size: 15px; }
.import-box .linkish { font-size: 14px; padding: 8px; }

/* ------------------------------------------------------------- Toolbar */

.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.toolbar .btn-lake { margin-left: auto; padding: 0 22px; }

/* --------------------------------------------------- Relative importance */

.weights-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 18px;
  background: var(--linen-shade);
  font-size: 13.5px;
  line-height: 1.5;
}
.weights-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 14px; }
.weights-head h2 { font-family: var(--font-head); font-weight: 700; font-size: 17px; color: var(--pine); }
.weights-status {
  margin-left: auto;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 13px;
}
.weights-status .linkish { padding: 6px 0; }
.reason-needed { color: var(--alert); }
.weights-box p { margin: 0; color: var(--charcoal); }
.defs-toggle {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--pine);
  font-family: inherit;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
}
.defs-chevron { display: inline-block; width: 12px; font-size: 11px; }
.defs-toggle[aria-expanded="true"] .defs-chevron { transform: rotate(90deg); }
.defs {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  background: var(--white);
  border: 1px solid var(--hairline);
}
.defs p {
  display: grid;
  grid-template-columns: 150px 44px minmax(0, 1fr);
  gap: 4px 12px;
  align-items: center;
}
.defs strong { font-weight: 600; color: var(--pine); }
.w-box {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  height: 22px;
  width: 44px;
  padding: 0 4px;
  border: 1px solid transparent;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12.5px;
  color: var(--pine);
}
.w-box.is-unset { border: 1px dashed var(--muted); }

/* ------------------------------------------------------------ The list */

.list-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: -8px;
}
.list-head .linkish { font-size: 13.5px; font-weight: 600; padding: 6px 0; }
.list-summary { font-size: 13px; color: var(--moss); margin: 0; }
.sort-label {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--pine);
}
.sort-label select {
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--field);
  background: var(--white);
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 400;
  color: var(--pine);
  outline-color: var(--lake);
  cursor: pointer;
}

.table { background: var(--white); border: 1px solid var(--hairline-card); }
.row-grid {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) minmax(0, 1.3fr) 124px 64px;
  gap: 12px;
}
.table-head {
  align-items: end;
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--hairline-row);
  font-size: 12px;
  font-weight: 600;
  color: var(--moss);
}
.sort-col {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  text-align: right;
}
.carets { display: flex; flex-direction: column; }
.caret {
  display: block;
  width: 18px;
  height: 13px;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 9px;
  line-height: 13px;
  color: var(--caret-off);
  cursor: pointer;
}
.caret[aria-pressed="true"] { color: var(--pine); }

.row {
  align-items: start;
  padding: 12px;
  border-bottom: 1px solid rgba(14, 61, 50, 0.1);
  background: var(--white);
  outline-offset: -1.5px;
  cursor: pointer;
}
.row.is-below { background: var(--below-cut); }
.row.is-selected { background: var(--linen-shade); outline: 1.5px solid var(--pine); }
.row.is-dragging { opacity: 0.45; }
.row.drop-before, .cut-row.drop-before { box-shadow: inset 0 3px 0 var(--lake); }
.row.drop-after, .cut-row.drop-after { box-shadow: inset 0 -3px 0 var(--lake); }

.row-rank { display: flex; align-items: center; gap: 6px; color: var(--moss); }
.grip { font-size: 14px; letter-spacing: -2px; cursor: grab; }
.row.no-drag .grip, .row.no-drag .row-moves { visibility: hidden; }
.row-pos { font-family: "IBM Plex Mono", monospace; font-size: 13px; }
.row-title { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.row-title-text {
  font-weight: 500;
  font-size: 14.5px;
  line-height: 1.35;
  color: var(--pine);
  overflow-wrap: anywhere;
}
.row-title-text.is-untitled { color: var(--muted); }
.row-flag { font-size: 12.5px; font-weight: 600; color: var(--alert); }
.row-noev {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--charcoal);
}
.dot-amber { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); flex-shrink: 0; }
.row-status {
  align-self: flex-start;
  padding: 0 7px;
  border: 1px dashed var(--muted);
  font-size: 12px;
  color: var(--moss);
}
.row-ps {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--charcoal);
}
.ps-clamp {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.row-ps .linkish { padding: 0; font-size: 13px; }
.row-ps .is-empty { color: var(--muted); }
.row-metric { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.row-metric-value {
  font-family: "IBM Plex Mono", monospace;
  font-size: 14px;
  font-weight: 500;
  color: var(--pine);
}
.row-metric-sub { font-size: 11.5px; color: var(--moss); text-align: right; }
.row-moves { display: flex; justify-content: flex-end; gap: 4px; }
.move {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(14, 61, 50, 0.2);
  background: var(--white);
  color: var(--pine);
  font-size: 11px;
  cursor: pointer;
}

.cut-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 12px;
  background: var(--linen-shade);
  border-top: 2px solid var(--pine);
  cursor: grab;
}
.cut-row strong { font-weight: 600; font-size: 13.5px; color: var(--pine); }
.cut-row span.cut-note { font-size: 12.5px; color: var(--moss); }
.cut-row .row-moves { margin-left: auto; }
.cut-row .move { border-color: rgba(14, 61, 50, 0.25); }

.unscored-head {
  padding: 16px 16px 10px;
  border-top: 1px solid var(--hairline-card);
  background: var(--linen);
}
.unscored-head p:first-child { font-weight: 600; font-size: 13.5px; color: var(--pine); }
.unscored-head p:last-child { margin-top: 2px; font-size: 12.5px; line-height: 1.45; color: var(--moss); }

.table-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 48px 24px 52px;
  text-align: center;
}
.table-empty p { max-width: 52ch; font-size: 14.5px; line-height: 1.55; color: var(--charcoal); }
.table-empty div { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.list-foot { font-size: 12.5px; line-height: 1.5; color: var(--moss); margin: 0; }

/* ------------------------------------------------------- The right panel */

.panel {
  position: sticky;
  top: 0;
  z-index: 20;
  box-sizing: border-box;
  width: 440px;
  height: 100vh;
  overflow-y: auto;
  background: var(--white);
  border-left: 1px solid var(--hairline-card);
}
.panel-backdrop { position: fixed; inset: 0; z-index: 19; background: rgba(10, 46, 38, 0.35); }
.panel-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 56px;
  padding: 0 12px 0 20px;
  background: var(--white);
  border-bottom: 1px solid var(--hairline);
}
.panel-kind { font-weight: 600; font-size: 13.5px; color: var(--moss); }
.panel-steps { margin-left: auto; display: flex; gap: 4px; }
.panel-step {
  height: 32px;
  padding: 0 12px;
  border: 1px solid rgba(14, 61, 50, 0.25);
  background: var(--white);
  color: var(--pine);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
}
.panel-step[disabled] { color: var(--muted); cursor: not-allowed; }
.panel-close {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: var(--pine);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.panel-close:hover { background: var(--linen-shade); }
.panel-close.is-alone { margin-left: auto; }
.panel-body { display: flex; flex-direction: column; gap: 22px; padding: 20px 20px 32px; }
.panel-body > div { display: flex; flex-direction: column; gap: 8px; }
.panel-label { font-weight: 600; font-size: 13px; color: var(--pine); margin: 0; }
.panel-label .soft { font-weight: 400; color: var(--moss); }
.panel-note { font-size: 12px; line-height: 1.45; color: var(--moss); margin: 0; }
.panel-foot {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px 20px;
  background: var(--white);
  border-top: 1px solid var(--hairline-card);
}
.panel-foot span { font-size: 12px; color: var(--moss); }

/* Below 1100px the panel slides over the list instead of beside it. */
@media (max-width: 1099px) {
  .tool-grid.is-split { grid-template-columns: minmax(0, 1fr); }
  .panel {
    position: fixed;
    top: 0;
    right: 0;
    width: min(440px, 100vw);
    box-shadow: -12px 0 32px rgba(10, 46, 38, 0.18);
  }
}

/* --- Candidate panel ---------------------------------------------------- */

.cand-title {
  box-sizing: border-box;
  width: 100%;
  padding: 4px 0;
  border: 0;
  border-bottom: 1px solid rgba(14, 61, 50, 0.2);
  background: transparent;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 20px;
  line-height: 1.25;
  color: var(--pine);
  outline-color: var(--lake);
}
.cand-title.is-over { border-bottom: 1.5px solid var(--alert); }
.cand-count { font-size: 12px; color: var(--moss); margin: 0; }
.cand-count.is-over { color: var(--alert); font-weight: 600; }
.cand-desc {
  box-sizing: border-box;
  width: 100%;
  padding: 4px 0;
  border: 0;
  background: transparent;
  resize: vertical;
  font-family: var(--font-body);
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--moss);
  outline-color: var(--lake);
}
.ps-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.ps-head a { font-size: 13px; }

.editor { border: 1px solid var(--field); }
.editor.is-error { border: 1.5px solid var(--alert); }
.editor-bar { display: flex; gap: 2px; padding: 4px 6px; border-bottom: 1px solid var(--hairline); }
.editor-bar button {
  min-width: 32px;
  height: 30px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: var(--pine);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
}
.editor-bar button:hover { background: var(--linen-shade); }
.editor-bar .is-bold { font-weight: 700; }
.editor-bar .is-italic { font-style: italic; }
.editor-bar .is-link { text-decoration: underline; }
.editor-area {
  padding: 10px 12px;
  font-size: 13.5px;
  line-height: 1.55;
  outline-color: var(--lake);
}
.editor-area.is-ps { min-height: 96px; }
.editor-area.is-src { min-height: 72px; }
.editor-area:empty::before { content: attr(data-placeholder); color: var(--muted); }
.editor-area ul { margin: 0; padding-left: 20px; }

.glance { gap: 10px !important; padding: 14px 16px; background: var(--linen); }
.glance-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.glance-cell { display: flex; flex-direction: column; gap: 2px; }
.glance-cell span:first-child { font-size: 12px; color: var(--moss); }
.glance-cell span:last-child { font-family: "IBM Plex Mono", monospace; font-size: 15px; color: var(--charcoal); }
.glance-cell.is-adj span:last-child { font-weight: 500; color: var(--pine); }
.glance-missing { font-size: 12.5px; line-height: 1.5; color: var(--moss); margin: 0; }
.glance-place {
  padding-top: 8px;
  border-top: 1px solid var(--hairline);
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--charcoal);
  margin: 0;
}
.glance-noev { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; margin: 0; }

.factors { gap: 12px !important; }
.factor { display: flex; flex-direction: column; gap: 6px; }
.factor-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.factor-name { font-size: 14px; font-weight: 500; color: var(--charcoal); }
.factor-weight { font-family: "IBM Plex Mono", monospace; font-size: 12px; color: var(--moss); }
.factor-note { font-size: 12px; font-weight: 600; color: var(--pine); }
.factor-contrib {
  margin-left: auto;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  color: var(--moss);
}
.steps { display: flex; align-self: flex-start; outline-offset: 1px; }
.steps.is-unrated { outline: 1px dashed var(--muted); }
.step {
  width: 44px;
  height: 36px;
  margin-left: -1px;
  border: 1px solid var(--field);
  background: var(--white);
  color: var(--pine);
  font-family: "IBM Plex Mono", monospace;
  font-size: 14px;
  cursor: pointer;
}
.steps.is-unrated .step { color: var(--muted); }
.step[aria-pressed="true"] { border-color: var(--pine); background: var(--pine); color: var(--linen); }
.step-ends {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  max-width: 216px;
  font-size: 11.5px;
  line-height: 1.35;
  color: var(--moss);
}
.step-ends span:last-child { text-align: right; }

.ev-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ev-stepper { display: flex; align-items: center; border: 1px dashed rgba(14, 61, 50, 0.35); }
.ev-stepper.has-value { border-style: solid; }
.ev-stepper button {
  width: 40px;
  height: 40px;
  border: 0;
  background: transparent;
  color: var(--pine);
  font-size: 18px;
  cursor: pointer;
}
.ev-stepper input {
  width: 52px;
  height: 40px;
  box-sizing: border-box;
  border: 0;
  border-left: 1px solid var(--hairline);
  border-right: 1px solid var(--hairline);
  text-align: center;
  font-family: "IBM Plex Mono", monospace;
  font-size: 15px;
  color: var(--pine);
  outline-color: var(--lake);
}
.remove-cand {
  align-self: flex-start;
  border: 0;
  background: transparent;
  padding: 6px 0;
  color: var(--moss);
  font-family: inherit;
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.remove-cand:hover { color: var(--alert); }

/* --- Weights panel ------------------------------------------------------ */

.panel-h2 { font-family: var(--font-head); font-weight: 700; font-size: 20px; color: var(--pine); margin: 0 0 6px; }
.panel-lede { font-size: 13.5px; line-height: 1.55; color: var(--moss); margin: 0; }
.weight-row { display: flex; align-items: center; gap: 12px; }
.weight-row label { flex: 1; font-size: 14px; }
.weight-row label .soft { font-size: 12px; color: var(--moss); }
.weight-row span { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--moss); }
.weight-row input {
  width: 72px;
  height: 40px;
  box-sizing: border-box;
  padding: 0 10px;
  border: 1px solid var(--field);
  background: var(--white);
  text-align: right;
  font-family: "IBM Plex Mono", monospace;
  font-size: 15px;
  outline-color: var(--lake);
}
.weight-total {
  margin: 4px 0 0;
  padding-top: 10px;
  border-top: 1px solid rgba(14, 61, 50, 0.15);
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 600;
  color: var(--pine);
}
.weight-total.is-off { color: var(--alert); }
.mult-note {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  background: var(--linen);
  font-size: 12.5px;
  line-height: 1.5;
}
.mult-note p { margin: 0; }
.mult-note p:first-child { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--pine); }
.proposed {
  padding: 0 6px;
  border: 1px dashed var(--moss);
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  font-weight: 400;
  color: var(--moss);
}
.mult-note p:last-child { color: var(--moss); }

/* --- Help panel --------------------------------------------------------- */

.help-body { font-size: 14px; line-height: 1.6; }
.help-body p { margin: 0; }
.help-data { padding: 14px 16px; background: var(--linen-deep); color: var(--charcoal); }
.help-body h3 { font-weight: 600; font-size: 14px; color: var(--pine); margin: 0 0 4px; }
.help-body ol { margin: 8px 0 0; padding-left: 22px; display: flex; flex-direction: column; gap: 4px; }
.help-body .mono { font-size: 12.5px; color: var(--moss); margin-top: 6px; }
.help-inline {
  display: inline;
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--lake);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.help-inline:hover { color: var(--pine); }

/* ------------------------------------------------------------ The strip */

.storage-strip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 14px 28px;
  background: var(--linen-shade);
  border-top: 1px solid var(--hairline);
  font-size: 13px;
  color: var(--moss);
}
.storage-strip .linkish { margin-left: auto; }

/* ------------------------------------------------------------- Dialogs */

.modal-wrap {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(10, 46, 38, 0.45);
  overflow-y: auto;
}
.modal {
  box-sizing: border-box;
  width: 100%;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  background: var(--white);
}
.modal.is-export { max-width: 520px; gap: 18px; }
.modal h2 { font-family: var(--font-head); font-weight: 700; font-size: 22px; color: var(--pine); }
.modal-field { display: flex; flex-direction: column; gap: 8px; }
.modal-field label { font-weight: 600; font-size: 13px; color: var(--pine); }
.modal-hint { font-size: 12px; line-height: 1.5; color: var(--moss); margin: 0; }
.modal-count { font-size: 13.5px; color: var(--charcoal); margin: 0; }
.modal-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
}
.modal-actions .linkish { margin-right: auto; font-size: 14px; padding: 8px 0; }
.file-note { font-size: 12.5px; font-weight: 600; color: var(--alert); margin: 0; }
.file-note.is-ok { color: var(--pine); }

.format-group { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.format {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 12px 14px;
  border: 1.5px solid rgba(14, 61, 50, 0.25);
  background: var(--white);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}
.format[aria-checked="true"] { border-color: var(--pine); background: var(--linen-shade); }
.format span:first-child { font-weight: 600; font-size: 14.5px; color: var(--pine); }
.format span:last-child { font-size: 12.5px; color: var(--moss); }
.checks { display: flex; flex-direction: column; gap: 10px; }
.check-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
  font-size: 13.5px;
  line-height: 1.45;
}
.check-dot { margin-top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--sage); }
.check-dot.is-warn { background: var(--amber); }
.check-dot.is-stop { background: var(--alert); }
.check-row .linkish { font-size: 13.5px; padding: 0; }
.check-text.is-stop { color: var(--alert); font-weight: 600; }

/* --------------------------------------------------------------- Toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 50;
  transform: translateX(-50%);
  max-width: min(560px, calc(100vw - 40px));
  padding: 12px 18px;
  background: var(--pine);
  color: var(--linen);
  font-size: 14px;
  line-height: 1.45;
}

/* ----------------------------------------------------------- Phone size */

@media (max-width: 719px) {
  .tool-main { padding: 20px 16px 36px; }
  .work { box-shadow: 0 0 0 16px var(--linen); }
  .storage-strip { padding: 14px 16px; }
  /* Five columns do not fit a phone. The row becomes two: the rank and the
     moves sit on one line, everything else stacks under it. */
  .row-grid { grid-template-columns: 44px minmax(0, 1fr); }
  .table-head { display: none; }
  .row { gap: 6px 10px; }
  .row-rank { grid-row: 1; }
  .row-title { grid-column: 2; grid-row: 1; }
  .row-ps, .row-metric { grid-column: 2; }
  .row-metric { align-items: flex-start; }
  .row-metric-sub { text-align: left; }
  .row-moves { grid-column: 1; grid-row: 2; justify-content: flex-start; }
  .defs p { grid-template-columns: minmax(0, 1fr) 44px; }
  .defs p span:last-child { grid-column: 1 / -1; }
  .glance-grid { grid-template-columns: 1fr; }
  .cut-row { flex-wrap: wrap; }
}
