/* Styles for the platform pages: fees.js, audit.js, settings.js. Prefix: pf-. Colours only from tokens.css. */

/* ---------- shared bits ---------- */
.pf-mono { font-family: var(--font-mono); font-size: 12.5px; }
.pf-wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.pf-grid { align-items: start; }
.pf-tiles { margin-bottom: 0; }
.pf-section-title { font-size: 15px; color: var(--text); }
.pf-section-head { display: flex; flex-direction: column; gap: 2px; }
.pf-section-head p { max-width: 90ch; }

/* ---------- fees & limits: payment methods ---------- */
.pf-methods { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .pf-methods { grid-template-columns: minmax(0, 1fr); } }
.pf-method-title { display: inline-flex; align-items: center; gap: 8px; }
.pf-method-title svg { color: var(--brand); }
.pf-method .card-head .tools .field { gap: 0; }
.pf-method-toggle .switch > span:last-child { min-width: 24px; font-weight: 600; font-size: 13px; color: var(--text-2); }
.pf-method-fields {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px 16px;
  transition: opacity .15s;
}
.pf-method-fields.is-off { opacity: .55; }
.pf-method-fields .input-affix .input { padding-right: 52px; }
.pf-off-note {
  margin: 0 0 4px; padding: 8px 12px; border-radius: var(--radius);
  background: var(--warning-soft); color: var(--text); font-size: 12.5px;
}

/* ---------- fees & limits: conversion ---------- */
.pf-conversion { display: flex; flex-direction: column; gap: 18px; }
.pf-conv-default { max-width: 340px; }
.pf-conv-list { display: flex; flex-direction: column; }
.pf-conv-head,
.pf-conv-row {
  display: grid; align-items: center; gap: 8px 16px;
  grid-template-columns: minmax(0, 1fr) minmax(130px, 190px) minmax(150px, 220px);
}
.pf-conv-head {
  padding: 0 0 8px; border-bottom: 1px solid var(--border);
  font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3);
}
.pf-conv-row { padding: 10px 0; border-bottom: 1px solid var(--border); }
.pf-conv-row:last-child { border-bottom: 0; padding-bottom: 0; }
.pf-conv-cur { display: flex; flex-direction: column; min-width: 0; }
.pf-conv-cur b { font-weight: 600; overflow-wrap: anywhere; }
.pf-conv-row .input-affix .input { padding-right: 36px; }
/* the column header names the fee input on wide screens; the label stays for screen readers */
.pf-conv-row .field > label:not(.switch) {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------- fees & limits: unsaved-changes bar ---------- */
.pf-savebar {
  position: sticky; bottom: 16px; z-index: 20;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 12px 10px 16px;
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--warning) 45%, var(--border));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: pop-in .16s ease;
}
.pf-savebar-text { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13.5px; }
.pf-savebar-text svg { width: 18px; height: 18px; color: var(--warning); flex: none; }
.pf-savebar-actions { margin-left: auto; display: flex; gap: 8px; }

/* ---------- audit log ---------- */
.pf-audit .toolbar .select { max-width: 210px; }
.pf-actor-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
/* why a failed entry failed (a CoreSettle error on a poll): one line, full text in the tooltip and the drawer */
.pf-fail-reason {
  max-width: 190px; margin-top: 2px; color: var(--danger);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* target type and merchant under the target: cut to one short line */
.pf-target-sub { max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-tag-imp { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 30%, transparent); color: var(--warning); }
.pf-tag-imp svg { width: 12px; height: 12px; }
.pf-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.pf-chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  padding: 3px 4px 3px 11px; border-radius: var(--radius-pill);
  border: 1px solid color-mix(in srgb, var(--brand) 35%, transparent); background: var(--brand-soft);
  font-size: 12.5px;
}
.pf-chip b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pf-chip-x {
  width: 22px; height: 22px; flex: none; display: grid; place-items: center;
  border: 0; border-radius: 50%; background: transparent; color: var(--text-2);
}
.pf-chip-x:hover { background: var(--surface); color: var(--danger); }
.pf-chip-x svg { width: 14px; height: 14px; }

/* ---------- settings ---------- */
.pf-readonly {
  display: flex; align-items: center; min-height: 40px; padding: 8px 12px;
  border: 1px dashed var(--border-strong); border-radius: var(--radius);
  background: var(--surface-2); color: var(--text-2); overflow-wrap: anywhere;
}
.pf-current {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-2);
}
.pf-current b { display: block; font-size: 14.5px; }
.pf-current-icon {
  width: 36px; height: 36px; flex: none; display: grid; place-items: center;
  border-radius: 50%; background: var(--brand-soft); color: var(--brand);
}
.pf-current-icon svg { width: 18px; height: 18px; }

.pf-qr {
  display: flex; gap: 18px; align-items: center; flex-wrap: wrap;
  padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface-2);
}
.pf-qr-img { width: 156px; height: 156px; image-rendering: pixelated; border-radius: 8px; background: #fff; padding: 6px; flex: none; }
.pf-qr-key { min-width: 0; flex: 1 1 160px; }
.pf-qr-key .copyable code { white-space: normal; overflow-wrap: anywhere; }

.pf-codes {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px;
  padding: 14px; border: 1px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface-2);
}
.pf-codes code { font-size: 13.5px; letter-spacing: .04em; }

.pf-waiting { display: flex; align-items: flex-start; gap: 14px; }
.pf-waiting .spinner { flex: none; margin-top: 2px; }
.pf-spinner-sm { width: 14px; height: 14px; border-width: 2px; flex: none; }

.pf-device { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pf-tag-current { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 35%, transparent); color: var(--brand); }

.pf-form-section { display: flex; flex-direction: column; gap: 12px; }
.pf-form-section + .pf-form-section { border-top: 1px solid var(--border); padding-top: 18px; }
.pf-form-section h3 { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.pf-form-section > .field { max-width: 460px; }
.pf-platform .form-grid { max-width: 760px; }
.pf-platform .input-affix .input { padding-right: 76px; text-align: left; }

.pf-ok-row { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-2); }
.pf-ok-row b { color: var(--text); font-weight: 600; }

/* ---------- phones ---------- */
@media (max-width: 640px) {
  .pf-method-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .pf-method-fields .hint { display: none; }
  .pf-conv-head { display: none; }
  .pf-conv-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .pf-conv-cur { grid-column: 1 / -1; }
  .pf-conv-default { max-width: none; }
  .pf-savebar { bottom: 10px; padding: 10px 12px; }
  .pf-savebar-actions { margin-left: 0; width: 100%; }
  .pf-savebar-actions .btn { flex: 1 1 0; }
  .pf-codes { grid-template-columns: minmax(0, 1fr); }
  .pf-audit .toolbar > .field { flex: 1 1 140px; }
  .pf-audit .toolbar .select { max-width: none; }
  .pf-qr { justify-content: center; }
}
