/* The admin's and the Provider's area's pages: what site.css (loaded first: tokens, fonts, header, pills, cards, tables)
   does not have. Forms, notes, state badges and the bar under the header. Colour marks state, never quality. */

:root {
  --bad: #a3321f;
  --bad-tint: #fbecea;
  --bad-border: #f0cfc9;
}

.good { color: var(--green-text); }
.bad { color: var(--bad); }
.wrap-any { white-space: normal; overflow-wrap: anywhere; }

/* --- the bar under the header: the area's own pages, who is signed in --- */
.app-bar { background: var(--card); border-bottom: 1px solid var(--border); }
.app-bar-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; padding-top: 10px; padding-bottom: 10px; }
.who { margin-left: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 14px; }
.who form { margin: 0; }
button.link {
  font: inherit;
  color: var(--green-text);
  background: none;
  border: 0;
  padding: 0;
  min-height: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
button.link:hover { color: var(--green-dark); background: none; }

/* --- page --- */
.app { gap: 20px; padding-top: 32px; }
.app h1 { font-size: 40px; }
/* A public page (sign-in, provider sign-up): the site's hero spacing and title size. */
.app.public { padding-top: 48px; }
.app.public h1 { font-size: 52px; }
/* The sign-up's company name: only with "Not in the list" chosen. */
form.stack .if-other { display: flex; flex-direction: column; gap: 8px; }
form.stack:has(select[name="vendor"]) .if-other { display: none; }
form.stack:has(select[name="vendor"] option[value="other"]:checked) .if-other { display: flex; }
.crumbs { font-size: 14px; color: var(--muted); }
.crumbs ol { display: flex; flex-wrap: wrap; gap: 2px 8px; }
.crumbs li + li::before { content: "\203A"; margin-right: 8px; }
.lead, .aside { color: var(--text-soft); max-width: 46em; }
.hint, .rule { color: var(--muted); font-size: 13px; }
.err { color: var(--bad); font-size: 14px; }
.theirs { color: var(--state-text); font-size: 14px; overflow-wrap: anywhere; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.readiness { font-size: 16px; }
.page-link { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }

/* --- notes --- */
.note { padding: 12px 16px; border-radius: var(--radius-input); background: var(--state-bg); color: var(--text); }
.note.ok { background: var(--green-tint); }
.note.bad { background: var(--bad-tint); }
.note p + p { margin-top: 4px; }

/* --- figures of a round or a check: the site's figures, smaller --- */
dl.status { display: flex; flex-wrap: wrap; gap: 12px 32px; margin: 0; }
dl.status dt { font-size: 13px; color: var(--muted); }
dl.status dd { margin: 0; font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
dl.status dd.bad { color: var(--bad); }

/* --- panels: the site's cards --- */
.panel, .card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.card > :last-child:not(.scroll) { margin-bottom: 0; }
.panel.narrow, .card.narrow { max-width: 620px; }
.card.flush { padding: 8px 24px; }
.panel-bar { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; }
.panel-title { font: 600 22px/1.25 var(--serif); }
.panel-meta { color: var(--muted); }
.panel.account .panel-title { font: 600 18px/1.3 var(--sans); }
.account-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }

/* --- state badges --- */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  white-space: nowrap;
  text-decoration: none;
}
.badge.incomplete, .badge.pending, .badge.promo { background: var(--state-bg); border-color: var(--state-bg); color: var(--state-text); }
.badge.complete, .badge.enabled, .badge.applied, .badge.applied_unchanged, .badge.approved {
  background: var(--green-tint); border-color: var(--green-border); color: var(--green-dark);
}
.badge.skipped, .badge.disabled, .badge.rejected { border-style: dashed; }

/* --- tables inside panels ---
   A table wider than its card scrolls sideways inside the card, at every width, and the page alone scrolls
   vertically (the box has no height of its own). site.css lets a .scroll box overflow on a wide screen unless sort.js
   marks it .is-clipped; the admin does not load sort.js, so a wide table (the Spur lookups) ran past its card. */
main.app .scroll { overflow-x: auto; max-height: none; }
/* A Spur answer opened in its cell: wrapped at a readable width, so it does not widen the whole table. */
table.spur pre { max-width: 40em; white-space: pre-wrap; }
table.urls td.col-page { white-space: normal; overflow-wrap: anywhere; min-width: 16em; color: var(--muted); }
table.diff td.changed { color: var(--state-text); }
table.diff .old { color: var(--muted); text-decoration: line-through; }
ul.urls li + li { margin-top: 4px; }
details > summary { cursor: pointer; color: var(--green-text); padding: 4px 0; }
code.token { display: inline-block; padding: 6px 10px; background: var(--tint); border-radius: 8px; user-select: all; }
table.tokens th.wrap-any { min-width: 12em; }

/* --- forms --- */
form.stack { display: flex; flex-direction: column; gap: 8px; }
form.stack label { font-weight: 600; font-size: 14px; margin-top: 6px; }
input[type="text"], input[type="email"], input[type="password"], textarea, select {
  font: 15px/1.4 var(--sans);
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-input);
  padding: 10px 12px;
  width: 100%;
  min-height: 44px;
}
textarea { resize: vertical; }
/* The select's arrow is drawn, as the calculator's (site.css .calc select). */
select {
  padding-right: 38px;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: right 19px center, right 14px center;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
fieldset.choice { border: 1px solid var(--input-border); border-radius: var(--radius-input); padding: 10px 12px; margin: 6px 0 0; min-width: 0; }
fieldset.choice.has-error { border-color: var(--bad); }
fieldset.choice legend { font-weight: 600; font-size: 14px; padding: 0 4px; }
fieldset.choice .hint { margin: 0 0 8px; }
form.stack fieldset.choice label { display: flex; align-items: center; gap: 8px; font-weight: 400; margin-top: 4px; }
input[type="radio"] { width: 18px; height: 18px; accent-color: var(--green-text); margin: 0; flex: none; }
.nowrap { white-space: nowrap; }
/* Focus: the border darkens, and the keyboard's focus gets the site's ring (site.css :focus-visible, 2px --green-text). */
input:focus, textarea:focus, select:focus { border-color: var(--green-text); }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--green-text); outline-offset: 2px; }
[aria-invalid="true"], .has-error > input, .has-error > textarea { border-color: var(--bad); }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--green-text); margin: 0; flex: none; }
input[type="file"] { font: 14px var(--sans); max-width: 100%; }
input[type="file"]::file-selector-button {
  font: 600 14px/1 var(--sans);
  padding: 10px 16px;
  margin-right: 12px;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-input);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
}
button, a.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 20px;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-input);
  background: var(--card);
  color: var(--text);
  font: 600 15px/1 var(--sans);
  text-decoration: none;
  cursor: pointer;
}
button:hover, a.button:hover { border-color: var(--green-text); color: var(--green-dark); }
button.primary, a.button.primary { background: var(--green-text); border-color: var(--green-text); color: #ffffff; }
button.primary:hover, a.button.primary:hover { background: var(--green-dark); border-color: var(--green-dark); color: #ffffff; }
button.danger { color: var(--bad); border-color: var(--bad-border); }
button.danger:hover { background: var(--bad-tint); color: var(--bad); border-color: var(--bad); }
form.stack button { align-self: flex-start; margin-top: 8px; }
.buttons { display: flex; flex-wrap: wrap; gap: 10px; }
.buttons form { margin: 0; }
.inline-approve { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0 0; }
form.inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0; }
form.inline label { color: var(--muted); }
form.inline input[type="text"] { width: auto; min-width: 12em; flex: 1 1 14em; }
form.inline select { width: auto; }
.tick { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 0; }

/* the URL form: one row per expected value */
.url-form { display: flex; flex-direction: column; gap: 20px; }
.fields .field {
  display: grid;
  grid-template-columns: 11em minmax(0, 1fr) auto;
  gap: 4px 16px;
  align-items: start;
  padding: 14px 0;
  border-bottom: 1px solid var(--rule-light);
}
.fields .field:last-child { border-bottom: 0; }
.fields .field > .name { grid-column: 1; grid-row: 1; padding-top: 11px; font-weight: 600; }
.fields .field > input, .fields .field > textarea { grid-column: 2; grid-row: 1; }
.fields .field > .tick { grid-column: 3; grid-row: 1; padding-top: 10px; white-space: nowrap; }
.fields .field > .rule, .fields .field > .err, .fields .field > .theirs { grid-column: 2 / 4; }
.shot-body { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
img.shot { display: block; max-width: 100%; max-height: 480px; border: 1px solid var(--border); border-radius: 8px; }

/* the price plan form of the Provider's area */
form.plan .grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 24px; }
form.plan .field { gap: 6px; min-width: 0; }
form.plan .field label { font-weight: 600; font-size: 14px; }

@media (max-width: 700px) {
  .app h1 { font-size: 30px; }
  .app.public { padding-top: 28px; }
  .app.public h1 { font-size: 36px; }
  .panel, .card { padding: 18px 16px; }
  .who { margin-left: 0; width: 100%; }
  .fields .field { grid-template-columns: 1fr; }
  .fields .field > * { grid-column: 1 !important; grid-row: auto !important; padding-top: 0 !important; }
  form.plan .grid { grid-template-columns: 1fr; }
  form.inline, form.inline select, form.inline input[type="text"], form.inline button { width: 100%; flex: 1 1 100%; }
  .buttons > *, .buttons button { flex: 1 1 100%; }
  img.shot { max-height: 360px; }
  table.urls .col-page { display: none; }
  /* the plans as cards: one block per plan, each value with its label */
  table.plans thead { display: none; }
  table.plans, table.plans tbody, table.plans tr, table.plans td { display: block; width: 100%; }
  table.plans tr { padding: 10px 0; border-bottom: 1px solid var(--rule-light); }
  table.plans tbody tr:last-child { border-bottom: 0; }
  table.plans td { border: 0; padding: 3px 0; white-space: normal; text-align: left; display: flex; gap: 12px; }
  table.plans td[data-label]::before { content: attr(data-label); flex: 0 0 8.5em; color: var(--muted); font-size: 14px; }
}

/* The filter row of the admin's tables (tablefilter.mjs). */
.table-filter { display: flex; flex-wrap: wrap; align-items: end; gap: 8px 12px; margin: 8px 0 10px; }
.table-filter input[type="search"] { flex: 1 1 14em; min-width: 10em; }
.table-filter-field { display: inline-flex; flex-direction: column; gap: 2px; font-size: 0.85em; }
.table-filter-count { margin-left: auto; color: var(--muted, #666); font-size: 0.85em; }
tr[hidden] { display: none; }
