/* AiB Platform — forms: fields, the branded file picker, the module-access
   pills, form cards and the row shapes forms live beside (members, mandates,
   invoice line editors). */

/* relative: the .field-hint summary parks in the label row's right corner */
.field { position: relative; margin-bottom: 16px; }
.field label {
  display: block;
  margin-bottom: 7px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--grey);
}
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  transition: border-color 0.25s;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--ink); }
/* checkboxes and radios keep their intrinsic box — the 100% width above is
   for text inputs (a stretched checkbox breaks any label riding beside it) */
.field input[type="checkbox"],
.field input[type="radio"] { width: auto; }

/* file inputs — brand the native picker wherever it appears (raw markup or
   Django-rendered fields): ghost-pill button, quiet filename text.
   The button values echo .btn--ghost on purpose and must stay a separate
   rule: a shared selector list would be dropped wholesale by any browser
   that doesn't parse ::file-selector-button, unstyling every ghost button. */
input[type="file"] {
  max-width: 100%;
  min-width: 0; /* iOS gives the picker an intrinsic width; never let it win */
  color: var(--grey);
  font-family: var(--font-body);
  font-size: 13px;
}
input[type="file"]::file-selector-button {
  margin-right: 12px;
  padding: 8px 16px;
  border: 1px solid var(--hairline-strong);
  border-radius: 999px;
  background: var(--white);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.25s;
}
input[type="file"]::file-selector-button:hover { border-color: var(--ink); }
/* inside .field the box chrome comes off — the pill button is the affordance */
.field input[type="file"] { padding: 0; border: 0; border-radius: 0; background: none; }

/* ---------- module picker (team management) ---------- */
/* Pill checkboxes — the interactive cousin of .chip--outline (the roster's
   Access column speaks the same vocabulary). Checked echoes .btn's ink pill;
   the dot fills the way a badge's does. Sodium stays out, as everywhere. */
.module-pick { border: 0; margin: 0 0 16px; padding: 0; min-width: 0; }
.module-pick-label {
  display: block;
  padding: 0;
  margin-bottom: 9px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--grey);
}
.module-pick-options { display: flex; flex-wrap: wrap; gap: 8px; }
/* The label is the one hover/click surface; the real checkbox hides under
   it with pointer-events off (a hoverable child that goes translucent on
   :hover flips its own stacking order and strobes the cursor). */
.module-pill { position: relative; cursor: pointer; }
.module-pill input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}
.module-pill span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 13px;
  border: 1px solid var(--hairline-strong);
  border-radius: 999px;
  background: var(--white);
  color: var(--grey);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  user-select: none;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.module-pill span::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  border: 1px solid currentColor;
  transition: background 0.2s;
}
.module-pill:hover span { border-color: var(--ink); color: var(--ink); }
.module-pill input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--white); }
.module-pill input:checked + span::before { background: currentColor; }
.module-pill:hover input:checked + span { opacity: 0.88; }
.module-pill input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ---------- staff forms & member lists ---------- */
.form-card { max-width: 620px; }
.form-card--wide { max-width: 760px; }
.form-errors { margin: 0 0 16px; color: var(--danger); font-size: 13px; }
.form-errors p { margin: 0 0 4px; }
/* a badge-led status line above or below a form (e.g. a VIES verdict) */
.form-notice { margin: 16px 0; }
.form-notice:first-child { margin-top: 0; }
/* unscoped: the team cards raise page-level errors outside any .field */
.field-help { display: block; margin-top: 6px; font-size: 12px; color: var(--grey-dark); }
.field-error { display: block; margin-top: 6px; font-size: 12.5px; color: var(--danger); }
.field .mono-input { font-family: var(--font-mono); font-size: 12.5px; line-height: 1.6; }

/* ---------- field hints (the ? beside a label) ---------- */
/* A details toggle, no JS. Closed it is only the absolutely-parked summary
   (zero flow height); open, the panel flows between label and input and
   pushes the form down — nothing overlaps, nothing needs a z-index. */
.field-hint > summary {
  position: absolute;
  top: -3px;
  right: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 19px;
  height: 19px;
  border: 1px solid var(--hairline-strong);
  border-radius: 50%;
  color: var(--grey);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1;
  list-style: none;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.25s, color 0.25s, background 0.25s;
}
.field-hint > summary::-webkit-details-marker { display: none; }
.field-hint > summary:hover { border-color: var(--ink); color: var(--ink); }
.field-hint[open] > summary { background: var(--ink); border-color: var(--ink); color: var(--white); }
.field-hint-panel {
  margin-bottom: 10px;
  padding: 12px 14px;
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
}
.field-hint-panel p { margin: 0; font-size: 12.5px; line-height: 1.55; color: var(--grey-dark); }
.field-hint-examples { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.field-hint-examples li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.field-hint-examples code {
  padding: 2px 7px;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  background: var(--white);
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink);
  overflow-wrap: anywhere; /* JSON examples wrap on phones, never widen the page */
}
.field-hint-examples li span { font-size: 12px; color: var(--grey); }
.form-actions { display: flex; align-items: center; gap: 14px; margin-top: 22px; }
.inline-form { display: inline; margin: 0; }
/* Two names for one row shape: .member-row (team, senders) and .mandate-item
   (the manage page's mandates and input fields). The CHILD rules carry the
   same union as the box rule — scoped to .member-row alone they silently
   dropped three declarations on every mandate and input row: .who-lines lost
   its flex, so the badge and ✕ sat against the text instead of the row's
   right edge; .name lost display:block, running name and detail together;
   and .email fell through to .mono, rendering an input key at 11.5px
   UPPERCASE instead of 12px grey and ellipsised. */
.member-row, .mandate-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--hairline); }
.member-row:first-child, .mandate-item:first-child { border-top: 0; }
.member-row .who-lines, .mandate-item .who-lines { min-width: 0; flex: 1; }
.member-row .who-lines .name, .mandate-item .who-lines .name { display: block; }
.member-row .who-lines .email, .mandate-item .who-lines .email { display: block; font-size: 12px; color: var(--grey); overflow: hidden; text-overflow: ellipsis; }

/* ---------- mandate list (deployment manage) ---------- */
.mandate-list { list-style: none; margin: 0; padding: 0; }
.mandate-item.is-inactive { opacity: 0.55; }
.mandate-item .drag-handle { cursor: grab; color: var(--grey-dark); font-size: 13px; user-select: none; }

/* ---------- touch: zoom-proof text controls ---------- */
/* iOS Safari auto-zooms — and STAYS zoomed, leaving the whole page panning
   sideways — when a focused text control sits under 16px. On touch screens
   every text control meets the threshold, so the zoom never fires. */
@media (pointer: coarse) {
  .field input,
  .field select,
  .field textarea,
  .field .mono-input { font-size: 16px; }
  input[type="file"] { font-size: 16px; }
  .field-hint > summary { width: 26px; height: 26px; font-size: 13px; }
}

/* ---------- commerce document line editor ---------- */
.lines-title { font-family: var(--font-display); font-weight: 640; font-size: 15px; margin: 22px 0 4px; }
.doc-line { display: flex; gap: 12px; }
.doc-line .field { flex: 0 0 132px; margin-bottom: 10px; }
.doc-line .field:first-child { flex: 1 1 auto; }
/* phones: the fixed qty/price/vat columns would push past the screen — wrap,
   description keeps the full first line, the numbers share the second */
@media (max-width: 719px) {
  .doc-line { flex-wrap: wrap; }
  .doc-line .field { flex: 1 1 96px; }
  .doc-line .field:first-child { flex: 1 1 100%; }
}
