/* v0.35.0 (owner 2026-10-12): AI limit levels — the person's answer-like note when a limit ran out, the
   administrator's "AI limiti" section and the per-person usage table. Colours come from the shared tokens in
   styles.css (dark theme follows); no inline styles anywhere (strict CSP). */

/* the note shown instead of an AI answer: looks like an answer bubble, amber accent, regular text size */
.ai-limit-note {
  margin: 10px auto 6px 0; width: fit-content; max-width: 92%; box-sizing: border-box; padding: 11px 14px;
  border: 1px solid color-mix(in srgb, var(--suspected, #b7791f) 35%, transparent);
  border-left: 4px solid var(--suspected, #b7791f); border-radius: 2px 10px 10px 10px;
  background: var(--suspected-light, #fdf4e3); color: var(--ink, #1f2933); overflow-wrap: anywhere;
}
.ai-limit-note-meta { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; font-size: 12px; line-height: 1.4;
  color: var(--ink-2, #536170); margin: 0 0 4px; }
.ai-limit-note-badge { display: inline-flex; align-items: center; min-height: 20px; padding: 0 8px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: .02em; background: var(--suspected, #b7791f); color: #fff; }
body .ai-limit-note p, body .msg .ai-limit-note p, body .pc-v022-item .ai-limit-note p {
  margin: 0; font-size: 15px; line-height: 1.55; font-weight: 400; font-style: normal; color: var(--ink, #1f2933);
}
.pc-v022-item .ai-limit-note { border-radius: 4px 16px 16px 16px; padding: 13px 16px; }
:root[data-theme="dark"] .ai-limit-note-badge { color: #1b1405; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ai-limit-note-badge { color: #1b1405; } }
@media (max-width: 640px) { .ai-limit-note, .pc-v022-item .ai-limit-note { max-width: 100%; width: auto; } }

/* administrator: Iestatījumi → AI limiti */
.ail-panel > header { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.ail-sheet [data-ail-body] { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ail-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; margin: 0; }
.ail-form > .actions, .ail-form > [data-ail-status] { grid-column: 1 / -1; margin: 0; }
.ail-level { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: var(--radius, 10px); background: var(--elevated, var(--surface)); }
.ail-level label { font-size: .95rem; line-height: 1.35; }
.ail-level p { margin: 0; overflow-wrap: anywhere; }
.ail-input-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ail-input-row input { width: 9.5em; max-width: 100%; min-height: 44px; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.ail-input-row input[aria-invalid="true"] { border-color: var(--compromised, #c0392b); }
.ail-input-row button { min-height: 40px; }
.ail-unit { font-size: .85rem; color: var(--ink-2); }
.ail-usage { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; line-height: 1.45; }
.ail-meter { display: block; width: 100%; height: 10px; margin: 2px 0; }
.ail-origin { font-size: .78rem; }
.ail-error:empty, [data-ail-status]:empty { display: none; }

/* "AI lietojums": per person */
.ail-usage-section > header { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
table.params.ail-table td { white-space: nowrap; }
table.params.ail-table th { white-space: normal; vertical-align: bottom; line-height: 1.25; }
table.params.ail-table td:first-child { white-space: normal; overflow-wrap: anywhere; min-width: 8em; }
.ail-table tr.ail-over td { background: var(--suspected-light, #fdf4e3); }
.ail-flag { display: inline-block; margin-left: 4px; padding: 0 7px; border-radius: 999px; font-size: .72rem; font-weight: 600;
  background: var(--suspected-light, #fdf4e3); color: var(--suspected, #8a5a00); border: 1px solid var(--suspected, #b7791f); }
@media (max-width: 640px) {
  .ail-form { grid-template-columns: 1fr; }
  .ail-level { padding: 12px; }
  .ail-input-row input { width: 100%; flex: 1 1 8em; }
}
