/* AIS in the search and the maps (docs/AIS.md §9.8). A sheet of its own so
   app.css, which other branches edit, is not touched. Only the existing
   tokens: every text pair is AA in both themes (tests/ais-web.test.mjs reads
   each rule's color and background); the state is always written, never
   colour alone. No style attribute anywhere: the heading angle travels as
   data-vars (--hdg). Touch screens: 44 px targets; reduced motion: the
   map flies without animation (web/ais-map.mjs) and app.css stops the rest. */

/* ---------- «Posición AIS» in Expediente ---------- */
.ais-search { margin-top: 18px; display: grid; gap: 8px; min-width: 0; }
.ais-search > * { min-width: 0; }
.ais-search-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.ais-search-head .sub-title { margin: 0; }
.ais-sub { margin: 6px 0 0; font: 700 11.5px/1.3 var(--font); letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.ais-results .ais-row { align-items: flex-start; }
.ais-row .ds-main .meta { white-space: normal; }
.ais-row-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.ais-suggestions, .ais-candidates { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ais-suggestion { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); background: var(--surface); }
.ais-suggestion-main { min-width: 0; overflow-wrap: anywhere; }
.ais-ask { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; }
.ais-kind { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.ais-why { display: inline-flex; align-items: flex-start; gap: 4px; }

/* ---------- chips: text and colour together ---------- */
.ais-chip { display: inline-flex; align-items: center; gap: 4px; font: 600 11px/1.35 var(--font); padding: 2px 8px; border-radius: var(--pill); border: 1px solid transparent; overflow-wrap: anywhere; }
.ais-chip.call-ok { color: var(--ok); background: var(--surface); border-color: var(--ok); }
.ais-chip.call-warn { color: var(--warn); background: var(--warn-soft); }
.ais-chip.call-validate { color: var(--warn); background: var(--surface); border: 1px dashed var(--warn); }
.ais-chip.call-muted { color: var(--muted); background: var(--surface-2); }
.ais-chip.age-fresh { color: var(--accent); background: var(--surface); border-color: var(--accent); }
.ais-chip.age-stale { color: var(--warn); background: var(--warn-soft); }
.ais-chip.age-old { color: var(--muted); background: var(--surface-2); border: 1px dotted var(--line-ctrl); }
.ais-chip.age-future { color: var(--danger); background: var(--danger-soft); }
.ais-chip.age-none { color: var(--muted); background: var(--surface-2); }
.ais-chip.test { color: var(--danger); background: var(--danger-soft); }
.ais-chip.conflict { color: var(--danger); background: var(--danger-soft); }

/* ---------- the card (search, dossier, map) ---------- */
.ais-detail { display: grid; gap: 8px; padding: 12px 14px; border: 1px solid var(--accent); border-radius: var(--r-m); color: var(--text); background: var(--surface); box-shadow: var(--sh-card); min-width: 0; }
.ais-detail:focus-visible { outline-offset: 3px; }
.ais-detail-head { display: flex; align-items: center; gap: 8px; }
.ais-detail-head h4 { margin: 0; flex: 1; display: flex; align-items: center; gap: 6px; font: 800 15px/1.3 var(--font-display); color: var(--text-strong); overflow-wrap: anywhere; }
.ais-card { display: grid; gap: 10px; min-width: 0; overflow-wrap: anywhere; }
.ais-sec { display: grid; gap: 4px; padding-top: 8px; border-top: 1px solid var(--line); }
.ais-sec:first-child { border-top: 0; padding-top: 0; }
.ais-sec h5 { margin: 0 0 2px; font: 700 11.5px/1.3 var(--font); letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.ais-sec p { margin: 0; }
.ais-sec .meta { display: block; }
.ais-ids { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.ais-visit { display: grid; gap: 3px; padding: 4px 0 4px 10px; border-left: 3px solid var(--line-strong); }
.ais-visit-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ais-none { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.ais-spot { font-style: italic; }
.ais-card.compact { gap: 6px; }

/* ---------- the dossier (TIMELINE / POSITION) ---------- */
.ais-dossier { display: grid; gap: 8px; padding: 10px 12px; border: 1px dashed var(--line-ctrl); border-radius: var(--r-m); color: var(--text); background: var(--surface); }
.ais-dossier-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-weight: 700; color: var(--text-strong); }

/* ---------- the map layer ---------- */
.ais-marker-icon { background: transparent; border: 0; }
.ais-marker { position: relative; width: 44px; height: 44px; display: grid; place-items: center; cursor: pointer; }
.ais-marker .ais-diamond { width: 14px; height: 14px; transform: rotate(45deg); border: 2px solid #fff; background: var(--accent); box-shadow: 0 1px 4px rgb(0 0 0 / .55); }
.ais-marker.age-stale .ais-diamond { background: var(--warn); }
.ais-marker.age-old .ais-diamond, .ais-marker.age-future .ais-diamond { background: var(--muted); border-style: dotted; }
.ais-marker.age-old, .ais-marker.age-future { opacity: .7; }
.ais-marker .ais-heading { position: absolute; inset: 0; transform: rotate(var(--hdg, 0deg)); pointer-events: none; }
.ais-marker .ais-heading::before { content: ""; position: absolute; left: calc(50% - 4px); top: 3px; border-left: 4px solid transparent; border-right: 4px solid transparent; border-bottom: 9px solid #fff; filter: drop-shadow(0 0 1px rgb(0 0 0 / .9)); }
.ais-marker .ais-label { position: absolute; top: 33px; left: 50%; transform: translateX(-50%); font: 700 11px/1.1 var(--font); color: #fff; text-shadow: 0 1px 3px rgb(0 0 0 / .9); white-space: nowrap; pointer-events: none; }
.ais-swatch { display: inline-block; width: 9px; height: 9px; margin: 0 5px 0 3px; transform: rotate(45deg); border: 1.5px solid #fff; background: var(--accent); box-shadow: 0 0 0 1px rgb(0 0 0 / .35); }
.ais-popup .ais-chip { font-size: 10.5px; }

/* ---------- Ajustes · AIS ---------- */
.ais-switch { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; font-weight: 600; }
.ais-switch .hint { flex-basis: 100%; font-weight: 400; }
.ais-lookups caption { text-align: left; font-size: 12px; padding: 4px 0; }
.ais-settings-server p { margin: 4px 0; }
[data-ais-usage] progress { width: min(260px, 100%); accent-color: var(--accent); vertical-align: middle; }

/* Touch screens: every target of the block and the card is 44 px high
   (app.css makes .btn and .chip-btn so; the rows here too). */
@media (pointer: coarse) {
  .ais-search .ds-row, .ais-suggestion, .ais-ask .btn, .ais-detail .btn, .ais-dossier .btn, .ais-switch { min-height: 44px; }
}
/* Phones: a button and what it costs stack. */
@media (max-width: 560px) {
  .ais-suggestion { flex-direction: column; align-items: stretch; }
  .ais-ask { display: grid; justify-items: start; }
}
