/* ===========================================================================
   The step-billing guide (/jira-service-management-recurring-tasks), layered
   on style.css: the byline, Estimated / Observed / Measured badges, wide tables with
   their captions above them, the "pages disagree" note, and the calculator.

   No inline styles anywhere on the page: its Content-Security-Policy allows
   stylesheets from this site only (public/_headers).
   =========================================================================== */

/* ------------------------------------------------------------- the head */

.crumbs {
  margin: 0 0 clamp(20px, 3vw, 32px);
  font-size: 14px;
  line-height: 1.4;
}

.crumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.crumbs li {
  margin: 0;
  padding: 0;
  color: var(--ink-3);
}

.crumbs li::marker {
  content: none;
}

/* The separator is drawn, so it is not read out between the links. */
.crumbs li + li::before {
  content: "/";
  content: "/" / "";
  margin: 0 10px;
  color: var(--ink-4);
}

.crumbs a {
  color: #c9cfd3;
  text-decoration-color: rgba(255, 255, 255, 0.22);
}

.byline {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  margin: 0 0 8px;
  color: var(--ink-3);
  font-size: 14.5px;
}

.byline strong {
  color: #c9cfd3;
  font-weight: 600;
}

/* ------------------------------------------------------------- badges */

.badge {
  display: inline-block;
  padding: 1px 9px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.6;
  letter-spacing: 0.01em;
  white-space: nowrap;
  vertical-align: 1px;
}

/*
  Amber for a number worked out, blue for what our own test showed in an
  audit log or on Automation's screens, teal for a number read off a meter.
*/
.badge--est {
  color: #e8c98a;
  box-shadow: inset 0 0 0 1px rgba(232, 201, 138, 0.45);
}

.badge--obs {
  color: #a9cdf2;
  box-shadow: inset 0 0 0 1px rgba(169, 205, 242, 0.45);
}

.badge--meas {
  color: var(--teal-lit);
  box-shadow: inset 0 0 0 1px rgba(78, 201, 168, 0.5);
}

/* ------------------------------------------------------------- tables */

.wide {
  max-width: 1040px;
}

/*
  680px is narrower than the scroll box at every width where the contents
  column is shown (from 1101px, where the box is about 688px with a classic
  scrollbar), so a laptop never gets a last column cut off mid-word. Below
  that the box is narrower and the table scrolls, as every table on a phone
  does.
*/
.table-scroll--wide table {
  min-width: 680px;
}

/* A cron line is copied as one, so it never wraps inside itself. */
td.cron code,
.tested th code {
  white-space: nowrap;
}

/* The test table lists several cron lines under one flow: a little air between them. */
.tested th code + code {
  margin-left: 6px;
}

.recipes td.tested,
.tested td {
  font-size: 14.5px;
}

/*
  A table's caption, as a paragraph above its scroll box. A <caption> is as
  wide as its table, so on a phone it scrolled away with it.
*/
.table-cap {
  max-width: 740px;
  margin: 0 0 12px;
  color: var(--ink-3);
  font-size: 14px;
  line-height: 1.5;
}

th[scope="row"] {
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
}

table code {
  font-size: 0.8em;
}

.rcp__m {
  display: block;
  margin-top: 2px;
  color: var(--ink-3);
  font-size: 13.5px;
  font-weight: 400;
}

/* The number in a job-table cell, above the words that explain it. */
.n {
  display: block;
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.rules td:last-child,
.jobs td {
  font-size: 14.5px;
}

.src,
.src__date {
  color: var(--ink-3);
  font-size: 14px;
}

.sources li {
  margin-bottom: 6px;
}

/* ------------------------------------------------------- the side note */

.note {
  max-width: 740px;
  margin: 8px 0 28px;
  padding: 18px 22px 4px;
  border: 1px solid var(--line-lit);
  border-radius: 14px;
  background: var(--surface);
}

.note > h3:first-child {
  margin-top: 0;
}

.note li {
  color: var(--ink-2);
}

/* --------------------------------------------------------- the checklist */

.checklist li {
  margin-bottom: 12px;
}

/* --------------------------------------------------------- the calculator */

.calc-fallback {
  max-width: 740px;
  padding: 14px 18px;
  border: 1px dashed var(--line-lit);
  border-radius: 12px;
  color: var(--ink-2);
}

.calc {
  max-width: 1040px;
  margin: 8px 0 32px;
  padding: clamp(16px, 3vw, 32px);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.calc[hidden] {
  display: none;
}

.calc__form {
  display: grid;
  gap: 28px;
}

.calc__set {
  display: grid;
  gap: 12px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.calc__title {
  float: left;
  width: 100%;
  margin: 0;
  padding: 0;
  color: var(--ink);
  font-size: 17px;
  font-weight: 600;
}

.calc__hint {
  margin: 0;
  color: var(--ink-3);
  font-size: 14px;
  line-height: 1.5;
}

.calc__products {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 12px;
}

.calc__product {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 8px 12px;
  align-content: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--ground-deep);
}

.calc__pname,
.calc__product .calc__hint {
  grid-column: 1 / -1;
  margin: 0;
}

.calc__pname {
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
}

.calc__field {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 6px;
  min-width: 0;
}

/* A label that wraps keeps its box on the same line as its neighbour's. */
.calc__field > label {
  align-self: end;
}

.calc label {
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}

/* Field edges at --ink-4, which keeps 3:1 against the ground. */
.calc select,
.calc input[type="number"] {
  width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 9px 12px;
  border: 1px solid var(--ink-4);
  border-radius: 10px;
  background: var(--ground-deep);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  line-height: 1.4;
}

.calc select:hover,
.calc input[type="number"]:hover {
  border-color: var(--ink-3);
}

.calc select:focus-visible,
.calc input:focus-visible {
  border-color: var(--teal);
  outline: 2px solid var(--teal);
  outline-offset: 1px;
}

.calc input:disabled {
  opacity: 0.45;
}

.calc__rows {
  display: grid;
  gap: 14px;
}

.calc__row {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.5fr) minmax(0, 0.7fr) minmax(0, 0.9fr);
  gap: 10px 12px;
  min-width: 0;
  margin: 0;
  padding: 10px 14px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--ground-deep);
}

.calc__legend {
  padding: 0 6px;
  color: var(--ink-3);
  font-size: 13.5px;
  font-weight: 600;
}

.calc__rowfoot {
  display: flex;
  grid-column: 1 / -1;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
}

.calc__rowsteps {
  margin: 0;
  color: var(--ink-2);
  font-size: 14px;
}

.calc__btn {
  justify-self: start;
  min-height: 44px;
  padding: 8px 18px;
  border: 1px solid var(--line-lit);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 14.5px;
  cursor: pointer;
}

.calc__btn:hover {
  border-color: var(--teal);
}

.calc__btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.calc__btn--quiet {
  min-height: 40px;
  padding: 6px 12px;
  border-color: transparent;
  color: var(--ink-3);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.calc__btn--quiet:hover {
  border-color: transparent;
  color: var(--ink);
}

.calc__check {
  display: flex;
  align-items: center;
  gap: 10px;
}

.calc__check input {
  flex: none;
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--teal);
}

.calc__outtitle {
  margin: 30px 0 12px;
}

.calc__out {
  padding: 18px 20px 6px;
  border: 1px solid var(--line-lit);
  border-radius: 12px;
  background: var(--ground-deep);
}

.calc__out p {
  max-width: 70ch;
  margin: 0 0 12px;
  color: #d0d6da;
}

.calc__out .table-scroll {
  margin-top: 6px;
}

.calc__out .table-scroll table {
  min-width: 480px;
}

.calc__badge {
  color: var(--ink-3);
  font-size: 14px;
}

@media (max-width: 760px) {
  .calc__row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
  .calc__field--wide {
    grid-column: 1 / -1;
  }
}

@media (max-width: 340px) {
  .calc__product,
  .calc__row {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media print {
  .calc,
  .calc-fallback {
    display: none;
  }
  .badge--est,
  .badge--obs,
  .badge--meas {
    color: #000;
    box-shadow: inset 0 0 0 1px #888;
  }
  .note {
    background: #fff;
  }
}
