/* ============================================================================
   LIDS v2 FIELD SYSTEM (2026-10-04). One look for every form control.
   ----------------------------------------------------------------------------
   Copied verbatim from the fleet registry, launch-shared
   registry/tokens/launch-tokens.css, which syncs into the CRM, TA Navigator and
   the calculator. The CRM ships this exact block (src/styles/launch-tokens.css).
   If the registry changes, change it there first and copy it here.

   Three patterns:
     .li-field-card  identity of a thing (who, how to reach them)
     .li-dense-row   facts about a thing (status, dates, money, addresses)
     .li-input / .li-select / .li-textarea  plain controls everywhere else
   Values that arrive from a state feed are read-only text with a timestamp
   and get no box (.li-dense-fact).

   Yellow is the focus mark: 1px ink border + 2px yellow ring, NO offset.
   Labels are sentence case 12px. The uppercase tracked eyebrow is for section
   headers, not field labels.

   OPT-IN FILE. It is deliberately NOT part of colors_and_type.css. That file
   is loaded at runtime by other repos, executed contracts among them, so form
   controls stay out of it. Load this file AFTER colors_and_type.css, which
   supplies the tokens. The v1 .li-label / .li-field / .li-field-grid rules
   that used to collide with these were retired from colors_and_type.css on
   2026-10-05 (Monica), so this file is now the only definition.

   Border-setting selectors are doubled on purpose (.li-field-card.li-field-card)
   so they win specificity ties against Tailwind utilities in the apps.
   ============================================================================ */
:root {
  --fld-bg:           var(--ink-0);
  --fld-border:       var(--ink-200);   /* hairline on plain controls and dense rows */
  --fld-border-soft:  var(--ink-150);   /* hairline on field cards */
  --fld-text:         var(--ink-1000);
  --fld-placeholder:  var(--ink-400);
  --fld-label:        var(--ink-600);   /* 12px sentence-case label above a control */
  --fld-label-cell:   var(--ink-50);    /* dense row left cell */
  --fld-focus-border: var(--ink-1000);
  --fld-focus-ring:   0 0 0 2px var(--li-yellow);
  --fld-radius:       8px;
  --fld-card-radius:  12px;
  --fld-h:            36px;
  --fld-row-h:        30px;
  --fld-chevron:      url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' fill='none' stroke='%236b7380' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/></svg>");
}

/* ---- Plain controls: native <input>, <select>, <textarea> ---------------- */
.li-input,
.li-select,
.li-textarea {
  display: block;
  width: 100%;
  height: var(--fld-h);
  padding: 0 12px;
  font: inherit;
  font-size: 14px;
  line-height: 1.3;
  color: var(--fld-text);
  background: var(--fld-bg);
  border: 1px solid var(--fld-border);
  border-radius: var(--fld-radius);
  outline: none;
  box-shadow: none;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.li-textarea,
textarea.li-input { height: auto; min-height: 80px; padding: 8px 12px; line-height: 1.45; resize: vertical; }
.li-textarea--compact { min-height: var(--fld-h); padding: 7px 12px; }
.li-select,
select.li-input {
  appearance: none; -webkit-appearance: none;
  padding-right: 32px;
  background-image: var(--fld-chevron);
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.li-input::placeholder, .li-textarea::placeholder { color: var(--fld-placeholder); }
.li-input:focus-visible,
.li-select:focus-visible,
.li-textarea:focus-visible { border-color: var(--fld-focus-border); box-shadow: var(--fld-focus-ring); }
.li-input[aria-invalid="true"], .li-input--invalid,
.li-select[aria-invalid="true"],
.li-textarea[aria-invalid="true"] { border-color: var(--li-red); }
.li-input:disabled, .li-select:disabled, .li-textarea:disabled { opacity: .5; cursor: not-allowed; }
/* Size and flow modifiers. Declared after the base so they win on source order. */
.li-input--sm, .li-select--sm { height: var(--fld-row-h); padding: 0 9px; font-size: 13px; }
.li-input--xs, .li-select--xs { height: 24px; padding: 0 6px; font-size: 12px; border-radius: 5px; }
.li-input--inline { display: inline-block; width: auto; }
/* The size modifiers above reset padding-right, which would put the chevron on
   top of the text; give it back to every small select. */
select.li-input--sm, select.li-input--xs,
.li-select--sm, .li-select--xs { padding-right: 26px; background-position: right 7px center; }

/* Label above a plain control. Sentence case; the uppercase tracked eyebrow is
   for section headers (.li-eyebrow), not for field labels. */
.li-label { display: block; margin-bottom: 6px; font-size: 12px; font-weight: 500; line-height: 1; color: var(--fld-label); }
.li-label--inline { display: inline; margin: 0; }
.li-hint  { display: block; margin-top: 6px; font-size: 12px; line-height: 1.35; color: var(--ink-500); }

/* ---- Field card: identity fields ----------------------------------------- */
.li-field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.li-field-grid--1 { grid-template-columns: minmax(0, 1fr); }
.li-field-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.li-field-card.li-field-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--fld-bg);
  border: 1px solid var(--fld-border-soft);
  border-radius: var(--fld-card-radius);
  cursor: text;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.li-field-card.li-field-card:focus-within { border-color: var(--fld-focus-border); box-shadow: var(--fld-focus-ring); }
.li-field-card__icon {
  width: 34px; height: 34px; flex: none;
  display: flex; align-items: center; justify-content: center;
  border-radius: 9px;
  background: var(--ink-100);
  color: var(--ink-600);
  transition: background-color .12s ease;
}
.li-field-card__icon svg { width: 16px; height: 16px; }
.li-field-card:focus-within .li-field-card__icon { background: var(--li-yellow); color: var(--ink-1000); }
.li-field-card__body { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.li-field-card__label { font-size: 11px; font-weight: 600; line-height: 1.2; color: var(--ink-500); }
.li-field-card__value,
.li-field-card input,
.li-field-card select,
.li-field-card textarea,
.li-field-card [role="combobox"] {
  width: 100%; min-width: 0;
  height: 22px; padding: 0;
  border: 0; border-radius: 0;
  background: transparent;
  font: inherit; font-size: 15px; font-weight: 500; line-height: 22px;
  color: var(--fld-text);
  outline: none; box-shadow: none !important;
}
.li-field-card [role="combobox"] { display: flex; align-items: center; justify-content: space-between; text-align: left; }
.li-field-card textarea { height: auto; min-height: 44px; line-height: 1.35; resize: none; }
.li-field-card input::placeholder, .li-field-card textarea::placeholder { color: var(--fld-placeholder); font-weight: 400; }
.li-field-card__value { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li-field-card__meta { font-size: 11px; line-height: 1.2; color: var(--ink-400); }
.li-field-card__trailing { flex: none; display: flex; align-items: center; color: var(--ink-500); }
.li-field-card--static.li-field-card--static { cursor: default; }

/* ---- Dense row: facts ---------------------------------------------------- */
.li-dense-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 8px; }
.li-dense-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.li-dense-grid--1 { grid-template-columns: minmax(0, 1fr); }
.li-span-2   { grid-column: span 2; }
.li-span-all { grid-column: 1 / -1; }

.li-dense-row.li-dense-row {
  display: flex;
  align-items: center;
  height: var(--fld-row-h);
  background: var(--fld-bg);
  border: 1px solid var(--fld-border);
  border-radius: 5px;
  overflow: hidden;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.li-dense-row.li-dense-row:focus-within { border-color: var(--fld-focus-border); box-shadow: var(--fld-focus-ring); }
.li-dense-row__label {
  width: 92px; flex: none; height: 100%;
  display: flex; align-items: center;
  padding: 0 8px;
  font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; line-height: 1;
  color: var(--ink-500);
  background: var(--fld-label-cell);
  border-right: 1px solid var(--ink-150);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: default;
}
.li-dense-row--wide .li-dense-row__label { width: 124px; }
.li-dense-row:focus-within .li-dense-row__label { color: var(--fld-text); }
.li-dense-row__control,
.li-dense-row input,
.li-dense-row select,
.li-dense-row [role="combobox"] {
  flex: 1; min-width: 0; height: 100%;
  padding: 0 9px;
  border: 0; border-radius: 0;
  background: transparent;
  font: inherit; font-size: 13px;
  color: var(--fld-text);
  outline: none; box-shadow: none !important;
}
.li-dense-row [role="combobox"] { display: flex; align-items: center; justify-content: space-between; text-align: left; }
.li-dense-row select { appearance: none; -webkit-appearance: none; padding-right: 26px; background-image: var(--fld-chevron); background-repeat: no-repeat; background-position: right 8px center; }
.li-dense-row input::placeholder { color: var(--fld-placeholder); }
.li-dense-row__value { flex: 1; min-width: 0; padding: 0 9px; font-size: 13px; color: var(--fld-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li-dense-row__meta { flex: none; padding-right: 9px; font-size: 10px; color: var(--ink-400); white-space: nowrap; }

/* Read-only fact from a state feed: same geometry, no box. */
.li-dense-fact { display: flex; align-items: center; height: var(--fld-row-h); border-radius: 5px; background: transparent; }
.li-dense-fact .li-dense-row__label { background: transparent; border-right: 1px solid var(--ink-150); }
