/* Price Setup (docs/PRICE_SETUP_PLAN.md step 6). Every colour is a token from styles.css,
   so both themes follow; nothing here names a hex. */
/* The page scrolls itself: `.view` is a flex column with min-height 0. */
#ps-root { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; }
.ps-wrap { max-width: 1100px; margin: 0 auto; padding: 20px 24px 48px; box-sizing: border-box; }
.ps-head h1 { margin: 0; font-size: 22px; }
.ps-sub { color: var(--text-dim); font-size: 13px; margin: 4px 0 0; }
.ps-hint { color: var(--text-faint); font-size: 12px; margin: 6px 0 0; }
.ps-none { color: var(--text-faint); font-size: 13px; margin: 0; }
.ps-dim { color: var(--text-faint); }
.ps-line { font-size: 13px; margin: 8px 0 0; }
.ps-empty { text-align: center; padding: 40px 16px; color: var(--text-dim); max-width: 560px; margin: 0 auto; }
.ps-empty h2 { color: var(--text); font-size: 17px; margin: 0 0 8px; }
.ps-empty p { margin: 0 0 14px; line-height: 1.55; }

.ps-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 16px 0; overflow-x: auto; }
.ps-tab { background: none; border: 0; color: var(--text-dim); padding: 8px 12px; cursor: pointer; font: inherit; border-bottom: 2px solid transparent; white-space: nowrap; }
.ps-tab.active { color: var(--text); border-bottom-color: var(--accent); }
.ps-count { color: var(--warn); font-size: 12px; }
.ps-filters { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 14px; }
.ps-chip { background: var(--bg-3); border: 1px solid var(--border); color: var(--text-dim); border-radius: 999px; padding: 4px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.ps-chip.active { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

/* lists of families / requests: real buttons, so a keyboard reaches every row */
.ps-list { display: flex; flex-direction: column; gap: 6px; }
.ps-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; width: 100%; text-align: left; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; color: var(--text); font: inherit; cursor: pointer; }
.ps-row:hover { border-color: var(--accent); }
.ps-row-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; min-width: 0; }
.ps-row-why { color: var(--text-dim); font-size: 13px; overflow-wrap: anywhere; }
.ps-row-meta { color: var(--text-faint); font-size: 12px; }

.ps-back { margin-bottom: 12px; height: 30px; }
.ps-fam-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.ps-fam-title { margin: 0; font-size: 20px; }
.ps-old { font-size: 13px; color: var(--warn); margin: 6px 0 0; }
.ps-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ps-actions .btn-mini { height: 32px; }
.ps-link { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; font-size: 13px; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

.ps-panel { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin: 12px 0; }
.ps-panel-h { font-size: 14px; margin: 0 0 8px; }
.ps-dl { display: grid; grid-template-columns: minmax(120px, max-content) 1fr; gap: 6px 14px; margin: 0; font-size: 13px; }
.ps-dl dt { color: var(--text-faint); }
.ps-dl dd { margin: 0; overflow-wrap: anywhere; }
.ps-ol { margin: 0; padding-left: 20px; font-size: 13px; line-height: 1.7; }
.ps-ladder { font-size: 13px; margin: 4px 0; }
.ps-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 12px; }
.ps-step-h { font-size: 13px; }
.ps-step-when { font-size: 12px; color: var(--accent); margin: 2px 0 0; }
.ps-step-what { font-size: 13px; color: var(--text-dim); margin: 4px 0 6px; line-height: 1.5; }
.ps-notes { white-space: pre-wrap; font-size: 13px; margin: 0; }
.ps-json { background: var(--bg-3); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; font-family: var(--mono); font-size: 12px; overflow: auto; max-height: 70vh; white-space: pre; color: var(--text); }

/* tables: their own scroller, so a wide one never widens the page on a phone */
.ps-tw { overflow-x: auto; max-width: 100%; margin: 6px 0 0; }
.ps-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ps-table th { text-align: left; color: var(--text-faint); font-weight: 500; padding: 6px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.ps-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.ps-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ps-up { color: var(--ok); }
.ps-down { color: var(--danger); }

.ps-pill { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 999px; background: var(--bg-3); color: var(--text-dim); border: 1px solid var(--border); white-space: nowrap; }
.ps-pill.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.ps-pill.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.ps-pill.bad { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.ps-pill.info { background: var(--info-soft); color: var(--info); border-color: transparent; }

/* a price change request */
.ps-req { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin: 0 0 14px; }
.ps-req.focus { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-soft); }
.ps-req-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ps-req-head h3 { margin: 0; font-size: 15px; }
.ps-reason { font-size: 13px; margin: 8px 0 0; }
.ps-sec { font-size: 13px; margin: 14px 0 0; }
.ps-bad { color: var(--danger); font-size: 13px; margin: 8px 0 0; }
.ps-why { font-size: 13px; color: var(--text-dim); background: var(--bg-3); border-radius: var(--radius-sm); padding: 8px 10px; margin: 0; }
.ps-decide { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.ps-note { font-size: 13px; border-radius: var(--radius-sm); padding: 8px 10px; background: var(--ok-soft); }
.ps-note.bad { background: var(--danger-soft); }
.ps-note p { margin: 0 0 6px; }
.ps-note p:last-child { margin-bottom: 0; }
.ps-card { border: 1px solid var(--accent); border-radius: var(--radius); padding: 12px 14px; background: var(--bg-1); }
.ps-card-kicker { font-size: 12px; color: var(--accent); margin: 0 0 4px; font-weight: 600; }
.ps-card-title { font-weight: 600; margin-bottom: 6px; }
.ps-card-body { max-height: 420px; overflow: auto; margin-bottom: 10px; }

/* a request a #price-setup/N link opened, and the link on every request's number */
.ps-reqlink { color: inherit; text-decoration: none; }
.ps-reqlink:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.ps-deepmiss { margin: 0 0 12px; }
.ps-np { margin: 6px 0 0; padding-left: 18px; font-size: 13px; line-height: 1.6; }
.ps-np li { overflow-wrap: anywhere; }

/* the families list's head, and the "A new family" panel */
.ps-list-head { display: flex; justify-content: flex-end; margin: 0 0 10px; }
.ps-center { justify-content: center; }
.ps-flash { margin: 0 0 12px; }

/* the setup editor */
.ps-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 16px; }
.ps-f { display: flex; flex-direction: column; gap: 4px; font-size: 13px; min-width: 0; margin: 0 0 12px; }
.ps-f > span { color: var(--text-dim); font-weight: 600; }
.ps-f em { font-style: normal; color: var(--text-faint); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.ps-f code, .ps-hint code { font-family: var(--mono); font-size: 11.5px; background: var(--bg-3); border-radius: 4px; padding: 0 4px; overflow-wrap: anywhere; }
.ps-in { background: var(--bg); border: 1px solid var(--border); color: var(--text); border-radius: var(--radius-sm); padding: 7px 9px; font: inherit; font-size: 13px; width: 100%; box-sizing: border-box; min-width: 0; }
.ps-in:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.ps-in[readonly] { color: var(--text-dim); background: var(--bg-3); }
.ps-in.num { text-align: right; font-variant-numeric: tabular-nums; }
textarea.ps-in { resize: vertical; line-height: 1.45; }
textarea.ps-in.mono { font-family: var(--mono); font-size: 12px; white-space: pre; overflow-x: auto; }
.ps-whenhelp { line-height: 1.6; }

/* an editable table: a grid per row, so a phone can stack each row as a card */
.ps-et { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.ps-er { display: grid; gap: 6px; align-items: center; }
.ps-et-factors .ps-er { grid-template-columns: minmax(0, 3fr) minmax(70px, 0.8fr) minmax(0, 2fr) auto; }
.ps-et-benchmarks .ps-er { grid-template-columns: minmax(0, 3fr) minmax(70px, 0.8fr) minmax(0, 2fr) minmax(110px, 1fr) auto; }
.ps-et-costs .ps-er { grid-template-columns: minmax(0, 3fr) minmax(70px, 0.8fr) minmax(0, 2fr) minmax(70px, 0.6fr) auto; }
.ps-eh { color: var(--text-faint); font-size: 12px; font-weight: 500; }
.ps-ec { display: flex; flex-direction: column; min-width: 0; }
.ps-ec-bool { flex-direction: row; align-items: center; justify-content: center; gap: 6px; font-size: 12px; color: var(--text-dim); }
.ps-ec-bool input { width: 16px; height: 16px; accent-color: var(--accent); }
.ps-cl { display: none; color: var(--text-faint); font-size: 11px; margin: 0 0 2px; }
.ps-er-act { display: flex; gap: 2px; justify-content: flex-end; }
.ps-ib { background: none; border: 1px solid transparent; color: var(--text-dim); border-radius: 6px; width: 28px; height: 28px; cursor: pointer; font: inherit; line-height: 1; }
.ps-ib:hover:not(:disabled) { background: var(--bg-hover); color: var(--text); }
.ps-ib:disabled { opacity: 0.35; cursor: default; }
.ps-add { margin-top: 2px; }
.ps-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ps-adv > summary { cursor: pointer; margin: 0; }
.ps-adv[open] > summary { margin-bottom: 10px; }

/* Save, with what is wrong beside it — sticky, so it is never a scroll away */
.ps-savebar { position: sticky; bottom: 0; z-index: 2; background: var(--bg-1); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-2); padding: 12px 14px; margin: 14px 0 0; display: flex; flex-direction: column; gap: 10px; }
.ps-probs { font-size: 13px; }
.ps-probs p { margin: 0; }
.ps-probs-h { font-weight: 600; color: var(--danger); }
.ps-probs ul { margin: 4px 0 0; padding-left: 18px; max-height: 150px; overflow-y: auto; overflow-wrap: anywhere; }
.ps-ok { color: var(--ok); }
#ps-ed-card:empty { display: none; }
/* a card waiting for its click is read in full: the bar stops floating over the form */
.ps-savebar.has-card { position: static; box-shadow: none; }
/* a button that cannot be pressed must LOOK it — Save stays off until the check passes */
.ps-wrap .btn-primary:disabled, .ps-wrap .btn-mini:disabled { opacity: 0.45; cursor: default; }

/* keyboard focus is always visible */
.ps-wrap button:focus-visible, .ps-wrap a:focus-visible, .ps-wrap summary:focus-visible, .ps-wrap input[type=checkbox]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (max-width: 640px) {
  .ps-wrap { padding: 14px 16px 40px; }
  .ps-dl { grid-template-columns: 1fr; }
  .ps-dl dd { margin-bottom: 4px; }
  .ps-panel, .ps-req { padding: 12px; }
  /* each table row stacks into a small card, every cell with its own label */
  .ps-eh { display: none; }
  .ps-cl { display: block; }
  .ps-et .ps-er { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding: 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
  .ps-et .ps-ec-when, .ps-et .ps-er-act { grid-column: 1 / -1; }
  .ps-ec-bool { justify-content: flex-start; }
  .ps-savebar { padding: 10px 12px; }
}

/* The company switch on Company → Plugins (app.js:renderPriceSetupAdminCard). */
.ps-switch-acts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 10px 0 4px; }
