/* v0.36.0 (owner 2026-10-13): individual AI limits — the block in an expanded "Lietotāji" row and the list in
   "Iestatījumi → AI limiti". Colours come from the shared tokens in styles.css (the dark theme follows); no inline
   styles anywhere (strict CSP). */

/* the block at the top of the expanded user row */
.aiu { margin: 0 0 14px; scroll-margin-top: 120px; }
.au-table tr.au-open { scroll-margin-top: 100px; }  /* opened from a link: the row stays clear of the sticky top bar */
.aiu-block { display: flex; flex-direction: column; gap: 10px; min-width: 0; padding: 12px 14px; background: var(--surface);
  border: 1px solid var(--line); border-left: 3px solid var(--indigo, #6366f1); border-radius: var(--radius, 6px); }
.aiu-head { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; }
.aiu-head h3 { margin: 0; font-size: 1rem; }
.aiu-head h3:focus { outline: none; }  /* a programmatic focus target (screen readers start here), not a control */
.aiu-tag { display: inline-flex; align-items: center; min-height: 22px; padding: 0 9px; border-radius: 999px; font-size: .75rem;
  font-weight: 600; background: var(--canvas-alt); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.aiu-tag-on { background: var(--indigo-light); color: var(--indigo); border-color: color-mix(in srgb, var(--indigo) 35%, var(--line)); }
.aiu-tag-old { background: var(--suspected-light); color: var(--suspected); border-color: color-mix(in srgb, var(--suspected) 40%, var(--line)); }

.aiu-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; }
.aiu-stat { display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 9px 11px; border-radius: var(--radius, 6px);
  background: var(--elevated); border: 1px solid var(--line); }
.aiu-stat-ind { border-color: color-mix(in srgb, var(--indigo) 40%, var(--line)); }
.aiu-stat-label { font-size: .78rem; color: var(--ink-2); }
.aiu-stat-value { font-size: .95rem; font-variant-numeric: tabular-nums; }
.aiu-stat-value b { font-size: 1.05rem; }
.aiu-meter { display: block; width: 100%; height: 8px; margin: 2px 0; }
.aiu-src { font-size: .75rem; color: var(--ink-muted); }
.aiu-stat-ind .aiu-src { color: var(--indigo); font-weight: 600; }
.aiu-total { margin: 0; }

.aiu-form { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.aiu-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px 12px; }
.aiu-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.aiu-field label { font-size: .88rem; font-weight: 600; line-height: 1.3; }
.aiu-field input { width: 100%; box-sizing: border-box; min-height: 42px; font-variant-numeric: tabular-nums; }
.aiu-field input[aria-invalid="true"] { border-color: var(--compromised); }
.aiu-field p { margin: 0; overflow-wrap: anywhere; }
.aiu-err:empty, .aiu-status:empty { display: none; }
.aiu-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 2px 0 0; }
.aiu-actions button { min-height: 40px; }
.aiu-status { margin: 0; }
.aiu-help, .aiu-origin { margin: 0; overflow-wrap: anywhere; }

/* Iestatījumi → AI limiti: the people with an individual limit */
.aiu-overrides { margin: 4px 0 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius, 6px);
  background: var(--elevated, var(--surface)); min-width: 0; }
.aiu-overrides h3 { margin: 0 0 4px; font-size: 1rem; }
.aiu-overrides > p { margin: 0 0 8px; overflow-wrap: anywhere; }
.aiu-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
/* name and link on the first line, the four values below (the settings column is narrow even on a wide screen) */
.aiu-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 14px; align-items: start;
  padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--indigo, #6366f1);
  border-radius: var(--radius, 6px); min-width: 0; }
.aiu-item-old { border-left-color: var(--suspected); }
.aiu-item-who { grid-column: 1; grid-row: 1; min-width: 0; overflow-wrap: anywhere; }
.aiu-item-mail { overflow-wrap: anywhere; }
.aiu-item-link { grid-column: 2; grid-row: 1; white-space: nowrap; justify-self: end; }
.aiu-item-vals { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 4px 12px; margin: 0; }
.aiu-item-vals div { min-width: 0; }
.aiu-item-vals dt { font-size: .72rem; color: var(--ink-muted); }
.aiu-item-vals dd { margin: 0; font-size: .88rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.aiu-item-note { grid-column: 1 / -1; margin: 0; overflow-wrap: anywhere; }
.aiu-empty { margin: 0; }

/* the per-person table on "AI lietojums": an individual level */
.ail-ind { display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 999px; font-size: .7rem; font-weight: 600;
  background: var(--indigo-light); color: var(--indigo); border: 1px solid color-mix(in srgb, var(--indigo) 35%, var(--line)); }

@media (max-width: 640px) {
  .aiu-item { grid-template-columns: minmax(0, 1fr); }
  .aiu-item-link { grid-column: 1; grid-row: auto; justify-self: start; }
  .aiu-item-vals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .aiu-block, .aiu-overrides { padding: 10px; }
  .aiu-stats, .aiu-fields { grid-template-columns: 1fr; }
  .aiu-actions button { flex: 1 1 100%; }
}
