/* ==========================================================================
   pages/agency-overview.css — Agency Portfolio dashboard (v2.18).
   Rendered into #dashboard-root by public/js/agencyOverview.js whenever
   no client is selected. Spec-exact: white surface, single accent
   #6D28D9, no gradients, no heavy shadows.
   ========================================================================== */

.ao-root {
  padding: 32px 40px;
  background: var(--bg);
  color: var(--text);
  font-family: 'Geist', 'Inter', system-ui, -apple-system, sans-serif;
  box-sizing: border-box;
}

/* ── Header ────────────────────────────────────────────────────────────── */

.ao-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.ao-header__title-block { min-width: 0; }

.ao-header__title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}

.ao-header__sub {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
}

.ao-add-btn {
  height: 36px;
  padding: 0 16px;
  background: var(--bg);
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease;
}
.ao-add-btn:hover {
  background: var(--accent);
  color: #fff;
}
.ao-add-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.ao-add-btn--solid {
  background: var(--accent);
  color: #fff;
  margin-top: 16px;
}
.ao-add-btn--solid:hover {
  background: var(--accent-hover);
  color: #fff;
  border-color: var(--accent-hover);
}

/* ── Stats bar ────────────────────────────────────────────────────────── */

.ao-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.ao-stat {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
}

.ao-stat__value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
  letter-spacing: -0.01em;
}

.ao-stat--accent  .ao-stat__value { color: var(--accent); }
.ao-stat--danger  .ao-stat__value { color: var(--danger); }
.ao-stat--success .ao-stat__value { color: var(--success); }

.ao-stat__label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

@media (max-width: 900px) {
  .ao-stats { grid-template-columns: repeat(2, 1fr); }
}

/* ── Two-column layout ────────────────────────────────────────────────── */

.ao-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
}

@media (max-width: 1100px) {
  .ao-layout { grid-template-columns: 1fr; }
}

/* ── Clients column ───────────────────────────────────────────────────── */

.ao-clients-col { min-width: 0; }

.ao-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.ao-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.ao-filter-tabs {
  display: inline-flex;
  gap: 4px;
}

.ao-filter-tab {
  height: 28px;
  padding: 0 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.ao-filter-tab:hover {
  color: var(--text);
  background: var(--bg-muted);
}
.ao-filter-tab.is-active {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent);
}

/* ── Card grid ────────────────────────────────────────────────────────── */

.ao-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.ao-grid-empty {
  padding: 32px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
  background: var(--bg-elevated);
  border: 1px dashed var(--border);
  border-radius: 10px;
}

/* ── Client card ──────────────────────────────────────────────────────── */

.ao-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 18px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-align: left;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
  box-sizing: border-box;
}
.ao-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.ao-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Score-bucket accents on the left edge */
.ao-card--attention { border-left: 3px solid #EF4444; }
.ao-card--healthy   { border-left: 3px solid #22C55E; }

.ao-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ao-card__ident {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.ao-card__favicon {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  object-fit: contain;
  background: var(--surface);
  flex-shrink: 0;
}

.ao-card__name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.ao-card__score {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}
.ao-card__score--healthy   { background: #F0FDF4; color: #16A34A; }
.ao-card__score--ok        { background: #FFFBEB; color: #D97706; }
.ao-card__score--attention { background: #FEF2F2; color: #DC2626; }
.ao-card__score--unknown   { background: var(--bg-muted); color: var(--text-secondary); }

/* Progress bar */

.ao-card__bar {
  width: 100%;
  height: 3px;
  background: var(--bg-muted);
  border-radius: 2px;
  margin: 10px 0;
  overflow: hidden;
}

.ao-card__bar-fill {
  height: 100%;
  width: 0;
  border-radius: 2px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}
.ao-card__bar-fill--healthy   { background: #22C55E; }
.ao-card__bar-fill--ok        { background: #F59E0B; }
.ao-card__bar-fill--attention { background: #EF4444; }
.ao-card__bar-fill--unknown   { background: var(--border); }

/* Bottom row */

.ao-card__bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ao-card__last {
  font-size: 11px;
  color: var(--text-secondary);
}

.ao-card__trend {
  font-size: 11px;
  font-weight: 600;
}
.ao-card__trend--up   { color: var(--success); }
.ao-card__trend--down { color: var(--danger); }
.ao-card__trend--flat { color: var(--text-secondary); font-weight: 500; }

/* ── Attention panel ──────────────────────────────────────────────────── */

.ao-attention {
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  border-radius: var(--radius-lg);
  padding: 16px;
  height: fit-content;
  align-self: start;
}

.ao-attention__head {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
}

.ao-attention__title {
  font-size: 13px;
  font-weight: 600;
  color: #92400e;
}

.ao-attention__list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ao-attention__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid #fde68a;
  border-radius: 8px;
}

.ao-attention__ident {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.ao-attention__favicon {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  object-fit: contain;
  background: var(--surface);
  flex-shrink: 0;
}

.ao-attention__name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.ao-attention__score {
  font-size: 13px;
  font-weight: 700;
  color: var(--danger);
  flex-shrink: 0;
}

.ao-attention__view {
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
  flex-shrink: 0;
}
.ao-attention__view:hover { text-decoration: underline; }

.ao-attention__healthy {
  font-size: 13px;
  color: var(--success);
  text-align: center;
  padding: 24px;
  font-weight: 500;
}

.ao-attention__divider {
  height: 1px;
  background: #fde68a;
  margin: 16px 0;
}

/* Quick actions */

.ao-quick-actions {
  display: flex;
  flex-direction: column;
}

.ao-quick-actions__title {
  font-size: 12px;
  font-weight: 600;
  color: #92400e;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}

.ao-qa-primary,
.ao-qa-secondary {
  width: 100%;
  height: 38px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.ao-qa-primary {
  background: var(--accent);
  color: #fff;
  border: none;
}
.ao-qa-primary:hover { background: var(--accent-hover); }

.ao-qa-secondary {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  font-weight: 500;
  margin-top: 8px;
}
.ao-qa-secondary:hover {
  background: var(--bg-subtle);
  border-color: var(--border-strong);
}

/* ── Skeleton (shimmer) ───────────────────────────────────────────────── */

.ao-skel {
  pointer-events: none;
}

.ao-skel-card {
  min-height: 116px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ao-skel-line {
  height: 12px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--surface) 0%, var(--border) 50%, var(--surface) 100%);
  background-size: 200% 100%;
  animation: ao-shimmer 1.4s ease-in-out infinite;
}
.ao-skel-line--lg  { width: 70%;  height: 16px; }
.ao-skel-line--md  { width: 100%; height: 14px; margin-top: 10px; }
.ao-skel-line--sm  { width: 40%;  height: 10px; }
.ao-skel-line--bar { width: 100%; height: 4px; }

@keyframes ao-shimmer {
  0%   { background-position: -100% 0; }
  100% { background-position:  100% 0; }
}

/* ── Zero-clients empty state ─────────────────────────────────────────── */

.ao-zero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 80px 24px;
  max-width: 480px;
  margin: 40px auto;
}

.ao-zero__icon {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border-radius: 12px;
  margin-bottom: 20px;
}

.ao-zero__title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.ao-zero__sub {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 4px;
  line-height: 1.5;
}

/* ── Error fallback ───────────────────────────────────────────────────── */

.ao-error {
  padding: 24px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 10px;
  color: #b91c1c;
  font-size: 13px;
  text-align: center;
  margin-top: 16px;
}
