/* Agent surface styles: Agent workspace. All new selectors are prefixed ag-
   and compose with advisor.css primitives (tile, lead-*, card-*, chip, tag,
   confirm-facts, filter-bar, btn-primary, btn-wa, avatar, listing-*,
   pipeline, share-toggle) rather than redefining them. */

/* ---------- Shared: cards, rows, chips ---------- */

.ag-card { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--hairline-strong); padding: 18px; }
.ag-card + .ag-card { margin-top: 14px; }
.ag-card-grid { display: grid; gap: 14px; }
.ag-card-grid .ag-card + .ag-card { margin-top: 0; }

.ag-list { display: grid; gap: 8px; margin-bottom: 8px; }
.ag-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ag-row-main { flex: 1 1 160px; min-width: 0; }
.ag-row.ag-row-done { opacity: 0.55; }

.ag-check {
  flex: none; width: 22px; height: 22px; border-radius: 50%;
  border: 1.5px solid var(--hairline-strong); display: inline-flex;
  align-items: center; justify-content: center; font-size: 12px; color: transparent;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.ag-row-done .ag-check { background: var(--accent); border-color: var(--accent); color: #fff; }

.lead-chip.ag-agent { background: transparent; color: var(--ink-body); border: 1px solid var(--hairline-strong); }

.ag-quiet { display: inline-block; font-size: 12px; font-weight: 600; color: var(--ink-muted); text-decoration: underline; text-underline-offset: 3px; margin: 2px 0 18px; }
.ag-quiet:hover { color: var(--ink); }

/* ---------- Leads: search, rows, detail, add-lead form ---------- */

.ag-lead-actions { display: flex; gap: 8px; align-items: center; }
.ag-lead-actions .ag-search { flex: 1; margin-bottom: 10px; }
.ag-lead-actions .btn-primary { flex: none; margin-bottom: 10px; white-space: nowrap; }

.ag-field { display: block; margin-bottom: 12px; }
.ag-input {
  width: 100%; font: inherit; font-size: 13px; color: var(--ink);
  background: var(--canvas-deep); border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-sm); padding: 11px 14px; outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.ag-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); background: var(--surface); }
.ag-form-actions { display: flex; gap: 8px; align-items: center; margin-top: 4px; }


.ag-search { width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--hairline-strong); border-radius: 999px; padding: 11px 18px; outline: none; margin-bottom: 10px; transition: border-color 0.2s, box-shadow 0.2s; }
.ag-search:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }

.ag-lead-row { display: block; width: 100%; text-align: left; cursor: pointer; transition: transform 0.2s var(--ease), box-shadow 0.2s; }
.ag-lead-row:hover { transform: translateY(-2px); box-shadow: var(--shadow-3); }

.ag-back { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--ink-muted); margin-bottom: 14px; transition: color 0.2s; }
.ag-back:hover { color: var(--ink); }
.ag-back svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.ag-timeline { list-style: none; margin-top: 6px; }
.ag-tl-item { display: flex; align-items: baseline; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--hairline); font-size: 12.5px; }
.ag-tl-item:last-child { border-bottom: 0; }
.ag-tl-type { flex: 0 0 74px; font-weight: 500; font-size: 11.5px; color: var(--accent-deep); }
.ag-tl-text { flex: 1 1 120px; color: var(--ink-body); }
.ag-tl-time { flex: none; font-size: 11px; color: var(--ink-muted); }

.ag-quicklog { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* ---------- Inventory ---------- */

.ag-feed-banner { background: var(--accent-wash); border-radius: var(--radius-sm); padding: 13px 15px; font-size: 13px; font-weight: 500; color: var(--accent-deep); margin-bottom: 16px; }

.ag-listing { position: relative; }
.ag-star {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.9); box-shadow: var(--shadow-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; line-height: 1; color: var(--ink-muted);
  transition: color 0.2s, transform 0.2s var(--ease), background 0.2s;
}
.ag-star:hover { transform: scale(1.08); }
.ag-star[aria-pressed="true"] { color: var(--accent-deep); background: var(--accent-wash); }

/* ---------- Profile ---------- */

.ag-toggle-list { display: grid; gap: 12px; margin-top: 4px; }

/* ---------- Accessibility: visible focus on new interactive elements ---------- */

.ag-lead-row:focus-visible, .ag-back:focus-visible, .ag-star:focus-visible, .ag-quiet:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* ---------- Responsive: mobile-first, widen at >=1024px ---------- */

@media (min-width: 1024px) {
  .ag-card-grid { grid-template-columns: 1fr 1fr; }
  .ag-list { grid-template-columns: 1fr 1fr; }
}
