/* Shared components (spec §10.2). Status is never colour alone: icon + label always. */
.icon { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.2em; }
.icon--sm { width: 1em; height: 1em; }
.icon--spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2); min-height: 36px; padding: 0 var(--s-4);
  border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text); font-weight: 500; white-space: nowrap;
  transition: transform var(--t-fast), background var(--t-fast), border-color var(--t-fast);
}
.btn:hover:not(:disabled) { background: var(--surface-3); border-color: rgba(25,20,102,.22); }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--primary { border: 0; background: var(--btn-grad); color: #fff; box-shadow: var(--glow); }
.btn--primary:hover:not(:disabled) { background: var(--btn-grad); filter: brightness(1.1); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn--ghost:hover:not(:disabled) { background: rgba(25,20,102,.06); color: var(--text); }
.btn--danger { color: var(--fail); }
.btn--sm { min-height: 28px; padding: 0 var(--s-3); font-size: var(--fs-13); }
.btn--icon { min-width: 36px; padding: 0; }
.btn--icon.btn--sm { min-width: 28px; }

/* Forms */
.field { display: flex; flex-direction: column; gap: var(--s-1); }
.field > label, .label { font-size: var(--fs-13); font-weight: 500; color: var(--text-2); }
.input, .select, .textarea {
  width: 100%; min-height: 36px; padding: 0 var(--s-3); border-radius: var(--r-sm); border: 1px solid var(--line-strong);
  background: var(--bg-2); color: var(--text); transition: border-color var(--t-fast);
}
.textarea { padding: var(--s-3); min-height: 120px; resize: vertical; font-family: var(--mono); font-size: var(--fs-13); line-height: 1.5; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:hover, .select:hover, .textarea:hover { border-color: rgba(25,20,102,.24); }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { border-radius: var(--r-sm); }
.input[aria-invalid="true"] { border-color: var(--fail); }
.hint { font-size: var(--fs-13); color: var(--text-2); }
.field-error { font-size: var(--fs-13); color: var(--fail); display: flex; gap: var(--s-1); align-items: center; }
.row { display: flex; gap: var(--s-3); align-items: center; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); }
.check { display: inline-flex; align-items: center; gap: var(--s-2); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--brand-1); }
input[type="range"] { accent-color: var(--brand-1); width: 100%; }

/* Glass cards */
.card {
  position: relative; padding: var(--s-5); border-radius: var(--r-md); border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-1); transition: transform var(--t-fast) var(--ease), border-color var(--t-fast);
}
.card--lift:hover { transform: translateY(-2px); border-color: var(--line-strong); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); margin-bottom: var(--s-4); }
.card-head h2 { font-size: var(--fs-16); }

/* Chips */
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: var(--r-pill); font-size: var(--fs-12);
  font-weight: 500; line-height: 20px; border: 1px solid var(--line-strong); color: var(--text-2); background: rgba(25,20,102,.04); white-space: nowrap;
}
.chip--fixnow { color: var(--fail); border-color: rgba(251,113,133,.4); background: rgba(251,113,133,.1); }
.chip--fixsoon { color: var(--warn); border-color: rgba(251,191,36,.4); background: rgba(251,191,36,.1); }
.chip--worth { color: var(--info); border-color: rgba(96,165,250,.4); background: rgba(96,165,250,.1); }
.chip--info { color: var(--nm); }
.chip--poor { color: var(--band-poor); border-color: rgba(251,113,133,.4); }
.chip--needs { color: var(--band-needs); border-color: rgba(251,191,36,.4); }
.chip--strong { color: var(--band-strong); border-color: rgba(96,165,250,.4); }
.chip--opt { color: var(--band-opt); border-color: rgba(52,211,153,.4); }
.chip--stale { color: var(--warn); border-color: rgba(251,191,36,.4); }

/* Status language: pass / fail / not measured (hatched, dashed). */
.status { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.status--pass { color: var(--pass); }
.status--fail { color: var(--fail); }
.status--nm {
  color: var(--nm); padding: 2px 8px; border: 1px dashed var(--nm); border-radius: var(--r-sm);
  background: repeating-linear-gradient(135deg, rgba(143,160,196,.12) 0 4px, transparent 4px 8px);
}

/* Score ring (mini): the SVG is built by the x-ring directive. */
.ring { display: inline-block; vertical-align: middle; }
.ring-track { stroke: rgba(25,20,102,.1); }
.ring-text { font: 700 11px var(--font); fill: var(--text); text-anchor: middle; dominant-baseline: central; }
.ring-none { display: inline-grid; place-items: center; width: var(--ring-size, 44px); height: var(--ring-size, 44px); color: var(--nm); border: 1px dashed var(--nm); border-radius: 50%; font-size: var(--fs-12); }
.band-poor { --band: var(--band-poor); }
.band-needs { --band: var(--band-needs); }
.band-strong { --band: var(--band-strong); }
.band-opt { --band: var(--band-opt); }

/* Tabs */
.tabs { display: flex; gap: var(--s-1); border-bottom: 1px solid var(--line); }
.tab {
  position: relative; padding: var(--s-3) var(--s-4); background: none; border: 0; color: var(--text-2); font-weight: 500; text-decoration: none;
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab[aria-selected="true"] { color: var(--text); }
.tab[aria-selected="true"]::after { content: ""; position: absolute; left: var(--s-3); right: var(--s-3); bottom: -1px; height: 2px; border-radius: 2px; background: var(--brand-grad); }

/* Tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: var(--fs-12); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-2); padding: var(--s-2) var(--s-3); border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
.table td { padding: var(--s-3); border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:hover { background: rgba(25,20,102,.03); }
.cell-name { font-weight: 600; }
.cell-sub { font-size: var(--fs-13); color: var(--text-2); }

/* Empty / error states */
.state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--s-4); padding: var(--s-7) var(--s-5); }
.state svg.motif { width: 120px; height: 80px; color: var(--text-3); }
.state p { max-width: 46ch; font-size: var(--fs-16); }
.state--error .icon { width: 32px; height: 32px; color: var(--fail); }
.banner {
  display: flex; align-items: flex-start; gap: var(--s-3); padding: var(--s-3) var(--s-4); border-radius: var(--r-sm);
  border: 1px solid var(--line-strong); background: var(--surface-2);
}
.banner--warn { border-color: rgba(251,191,36,.4); }
.banner--warn .icon { color: var(--warn); }
.banner--error { border-color: rgba(251,113,133,.4); }
.banner--error .icon { color: var(--fail); }
.banner .icon { margin-top: 2px; }
.banner-body { flex: 1; }

/* Delta */
.delta { display: inline-flex; align-items: center; gap: 2px; font-size: var(--fs-13); font-weight: 600; }
.delta--up { color: var(--pass); }
.delta--down { color: var(--fail); }
.delta--flat { color: var(--text-2); }
