/* ============================================================
   Agentic tab (pages/ticketing.html #tkAgenticView, wired by
   js/ticketing-agentic.js). Scoped entirely under .tk-wrap so it
   inherits --tk-ink/--tk-muted/--tk-border (see the .tk-wrap block in
   ticketing.css) and never leaks tokens onto another page.

   Deliberately built on the SHARED atoms (.card, .pill/.chip, .btn-*,
   .input) from css/global.css rather than a new bespoke "glass" card
   style: this tab is dense, list-like content (queue rows, lease rows,
   usage rows), same category as the results table -- and the same
   rule that keeps the results table off the glass veil (see the
   .tk-wrap .tk-table-card override just above this file's own rules
   in ticketing.css: "the results table, which is dense content, sits
   on --chart-plate instead") applies here: NO glass card style is used
   under these lists. .card (flat --surface/--border, already
   light/dark themed by those tokens) is the only "container" class
   this file adds visual weight to.

   Font sizes and radii below are ALL var(--type-*-size) / var(--r-*) --
   scripts/check-type-roles.py's ratchet must not go up.
   ============================================================ */

.tk-view-toggle {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: var(--tk-surface, var(--surface));
  border: 1px solid var(--tk-border, var(--border));
  border-radius: var(--r-ctl);
  margin-bottom: 16px;
  width: fit-content;
}

.tk-view-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border: 0;
  border-radius: var(--r-chip);
  background: transparent;
  color: var(--tk-muted);
  font-size: var(--type-button-size);
  font-weight: 600;
  cursor: pointer;
}

.tk-view-toggle-btn.is-active {
  background: var(--primary);
  color: #FFFFFF;
}

.tk-view-toggle-btn:not(.is-active):hover {
  background: var(--primary-soft);
  color: var(--tk-ink);
}

.tk-agentic-view {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tk-agentic-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.tk-agentic-hint {
  margin: 0;
  font-size: var(--type-caption-size);
  color: var(--tk-muted);
}

.tk-agentic-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.tk-agentic-card--wide {
  grid-column: 1 / -1;
}

.tk-agentic-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.tk-agentic-card-head h3 {
  margin: 0;
  font-size: var(--type-card-title-size);
  font-weight: 700;
  color: var(--tk-ink);
  display: flex;
  align-items: center;
  gap: 8px;
}

.tk-agentic-card-sub {
  margin: 4px 0 12px;
  font-size: var(--type-caption-size);
  color: var(--tk-muted);
}

.tk-agentic-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 340px;
  overflow-y: auto;
}

.tk-agentic-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--tk-border, var(--border));
  border-radius: var(--r-ctl);
  background: var(--surface);
}

.tk-agentic-row-rank {
  flex: 0 0 auto;
  font-size: var(--type-label-size);
  font-weight: 700;
  color: var(--tk-muted);
  min-width: 28px;
}

.tk-agentic-row-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tk-agentic-row-title {
  font-size: var(--type-body-size);
  font-weight: 600;
  color: var(--tk-ink);
  overflow-wrap: anywhere;
}

.tk-agentic-row-ticketno {
  font-weight: 700;
  color: var(--tk-primary, var(--primary));
}

.tk-agentic-row-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.tk-agentic-row-sub {
  font-size: var(--type-label-size);
  color: var(--tk-muted);
}

.tk-agentic-row-note {
  font-size: var(--type-caption-size);
  color: var(--tk-ink);
  background: var(--primary-soft);
  border-radius: var(--r-ctl);
  padding: 6px 10px;
  overflow-wrap: anywhere;
}

.tk-agentic-row-paths {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tk-agentic-path-chip {
  font-size: var(--type-label-size);
  font-family: inherit;
  padding: 2px 8px;
  border-radius: var(--r-chip);
  background: var(--surface);
  border: 1px solid var(--tk-border, var(--border));
  color: var(--tk-muted);
}

.tk-agentic-row-empty,
.tk-agentic-empty {
  font-size: var(--type-caption-size);
  color: var(--tk-muted);
  padding: 10px 4px;
}

.tk-agentic-usage-scope {
  display: inline-flex;
  gap: 4px;
  padding: 2px;
  background: var(--surface);
  border: 1px solid var(--tk-border, var(--border));
  border-radius: var(--r-ctl);
}

.tk-agentic-usage-scope .tk-view-toggle-btn {
  padding: 5px 12px;
  font-size: var(--type-label-size);
}

.tk-agentic-usage-totals {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.tk-agentic-usage-total {
  font-size: var(--type-kpi-number-size);
  font-weight: 700;
  color: var(--tk-ink);
  padding: 6px 14px;
  border-radius: var(--r-card);
  background: var(--primary-soft);
}

.tk-agentic-usage-overbudget {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--tk-border, var(--border));
}

.tk-agentic-overbudget-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--type-label-size);
  font-weight: 700;
  color: var(--danger);
  margin-bottom: 8px;
}

.tk-agentic-error {
  font-size: var(--type-caption-size);
  color: var(--danger);
  background: var(--danger-soft);
  border-radius: var(--r-ctl);
  padding: 10px 14px;
}

@media (max-width: 900px) {
  .tk-agentic-grid {
    grid-template-columns: 1fr;
  }
}
