/* Reporting › Agent report (public/agent-report.js). Colours come from the
   theme variables, so Midnight and Daylight restyle it; the Leaderboard keeps
   GHL's teal-to-navy whichever theme is on. */

.ag { display: flex; flex-direction: column; gap: 18px; transition: opacity .15s; }
.ag.busy .ag-body { opacity: .6; }
.ag-muted { color: var(--muted); }
.ag-ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ag-loading { padding: 56px 16px; text-align: center; color: var(--muted); }
.ag-empty { padding: 20px 0; text-align: center; color: var(--muted); }
.ag-error { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 16px; border: 1px solid var(--red); border-radius: var(--radius); color: var(--red); }

/* ----- toolbar ----- */
.ag-bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.ag-title { margin: 0; font-size: 24px; font-weight: 500; }
.ag-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ag-pick { position: relative; }
.ag-field { display: inline-flex; align-items: center; gap: 10px; height: 52px; padding: 0 16px; border: 0; border-radius: 6px; background: var(--hover); color: var(--text); font-size: 16px; }
.ag-field:hover { filter: brightness(.97); }
.ag-field:focus-visible, .ag-btn:focus-visible, .ag-select:focus-visible, .ag-option:focus-visible, .ag-chev:focus-visible, .ag-compare:focus-visible, .ag-day:focus-visible, .ag-link-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.ag-user-btn { min-width: 260px; justify-content: space-between; color: var(--text); }
.ag-user-btn svg, .ag-chev svg { color: var(--brand); flex: none; }
.ag-dates { display: flex; align-items: center; gap: 2px; }
.ag-icon-field { padding: 0 14px; border-radius: 6px 0 0 6px; color: var(--brand); }
.ag-range-text { min-width: 286px; border-radius: 0; border: 1px solid var(--line); background: var(--surface); }
.ag-chev { display: inline-flex; align-items: center; height: 52px; padding: 0 12px; border: 0; background: none; }
.ag-compare { display: inline-flex; align-items: center; gap: 6px; padding: 8px 10px; border: 0; background: none; color: var(--brand); font-size: 17px; font-weight: 600; opacity: .6; }
.ag-compare.on { opacity: 1; }
.ag-compare:hover { text-decoration: underline; }
.ag-btn { display: inline-flex; align-items: center; justify-content: center; padding: 8px 16px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--text); font-size: 14px; }
.ag-btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.ag-btn.primary:hover:not(:disabled) { filter: brightness(1.08); }
.ag-btn:disabled { opacity: .5; cursor: not-allowed; }
.ag-fetch { height: 52px; min-width: 110px; padding: 0 28px; font-size: 18px; font-weight: 600; }
.ag-link-btn { padding: 4px 8px; border: 0; background: none; color: var(--text); font-size: 15px; font-weight: 600; }
.ag-link-btn:hover { color: var(--brand); }

/* ----- menus ----- */
.ag-menu { position: absolute; z-index: 40; top: calc(100% + 4px); left: 0; min-width: 100%; max-height: 360px; overflow-y: auto; padding: 6px 0; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); box-shadow: 0 12px 32px rgba(16, 24, 40, .18); }
.ag-menu[hidden] { display: none; }
.ag-user-menu { width: 360px; padding-top: 0; }
.ag-menu-top { position: sticky; top: 0; display: flex; justify-content: space-between; padding: 14px 20px 8px; background: var(--surface); }
.ag-menu-empty { padding: 14px 20px; color: var(--muted); }
.ag-user-list { padding-bottom: 4px; }
.ag-option { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 9px 20px; border: 0; background: none; color: var(--text); font-size: 16px; text-align: left; }
.ag-option:hover { background: var(--hover); }
.ag-option.on { color: var(--brand); }
.ag-quick { left: auto; right: 0; min-width: 190px; }
.ag-select-menu { min-width: max-content; }
.ag-option { white-space: nowrap; }

/* ----- cards ----- */
.ag-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: stretch; }
.ag-col { display: contents; }
.ag-opps { grid-column: 1; grid-row: 1; } .ag-conv { grid-column: 2; grid-row: 1; } .ag-board { grid-column: 3; grid-row: 1 / span 2; }
.ag-sms { grid-column: 1; grid-row: 2; } .ag-email { grid-column: 2; grid-row: 2; }
.ag-card { display: flex; flex-direction: column; padding: 28px 30px 22px; border-radius: 4px; background: var(--surface); box-shadow: 0 1px 6px rgba(16, 24, 40, .14); min-width: 0; }
.ag-card-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; margin-bottom: 18px; }
.ag-card-title { display: flex; align-items: center; gap: 10px; min-width: 0; margin: 0; font-size: 30px; font-weight: 500; line-height: 1.2; }
.ag-help { display: inline-flex; color: var(--muted); cursor: help; }
.ag-help:focus-visible { outline: 2px solid var(--brand); border-radius: 50%; }
.ag-rows { display: flex; flex-direction: column; }
.ag-row { display: grid; grid-template-columns: minmax(0, 1fr) 76px 86px; align-items: center; gap: 10px; padding: 14px 0; border-bottom: 1px dotted var(--line); font-size: 17px; }
.ag-row:last-child { border-bottom: 0; }
.ag-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-val { text-align: right; font-variant-numeric: tabular-nums; }
.ag-delta { text-align: right; }
.ag-pct { display: inline-flex; align-items: center; gap: 2px; font-variant-numeric: tabular-nums; }
.ag-pct.up { color: var(--green); }
.ag-pct.down { color: var(--text); }
.ag-scroll { height: 300px; overflow-y: auto; margin-right: -12px; padding-right: 12px; }
.ag-plain { margin-left: auto; }
.ag-light { margin-left: auto; flex: 1 1 0; max-width: 190px; min-width: 120px; }
.ag-board .ag-card-title { flex: none; }
.ag-light .ag-select { width: 100%; justify-content: space-between; max-width: none; }
.ag-light .ag-select-menu { left: auto; right: 0; min-width: 220px; }
.ag-select { display: inline-flex; align-items: center; gap: 10px; max-width: 220px; padding: 6px 4px; border: 0; background: none; color: var(--text); font-size: 17px; }
.ag-light .ag-select { padding: 12px 20px; border-radius: 4px; background: #fff; color: #111; font-size: 16px; }

/* ----- leaderboard ----- */
.ag-board { color: #fff; background: linear-gradient(180deg, #05a199 0%, #0a7a82 45%, #07354f 100%); min-height: 640px; }
.ag-board .ag-card-title { color: #fff; }
.ag-board-table { margin-top: auto; display: flex; flex-direction: column; font-size: 17px; }
.ag-board-row { display: grid; grid-template-columns: 70px minmax(0, 1fr) 80px; gap: 10px; padding: 9px 0; opacity: .95; }
.ag-board-row.head { opacity: .75; }
.ag-board-row .r { text-align: right; }
.ag-light .ag-menu { color: var(--text); }

/* ----- call metrics ----- */
.ag-calls { margin: 0; }
.ag-totals { display: flex; justify-content: flex-end; gap: 36px; flex-wrap: wrap; margin-bottom: 26px; }
.ag-total { display: flex; align-items: baseline; gap: 14px; padding-bottom: 4px; border-bottom: 1px dotted var(--line); font-size: 22px; color: var(--muted); }
.ag-total b { color: var(--text); font-weight: 500; }
.ag-total .ag-pct { font-size: 22px; }
.ag-call-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 34px; }
.ag-block-title { margin: 0 0 6px; font-size: 24px; font-weight: 500; }
.ag-call-block .ag-row { grid-template-columns: minmax(0, 1fr) 54px 62px; gap: 4px; font-size: 16px; }
.ag-bottom { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
.ag-eff .ag-row { grid-template-columns: minmax(0, 1fr) auto 72px; gap: 8px; }

/* ----- calendar ----- */
.ag-cal { position: absolute; z-index: 40; top: calc(100% + 4px); left: 0; width: 320px; padding: 14px 16px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: 0 12px 32px rgba(16, 24, 40, .18); }
.ag-cal[hidden] { display: none; }
.ag-cal-head { display: flex; align-items: center; margin-bottom: 8px; }
.ag-cal-title { flex: 1; text-align: center; font-weight: 600; }
.ag-nav { display: inline-flex; padding: 4px; border: 0; border-radius: 6px; background: none; color: var(--muted); }
.ag-nav:hover { background: var(--hover); color: var(--text); }
.ag-grid { display: grid; grid-template-columns: repeat(7, 1fr); row-gap: 2px; }
.ag-dow { padding: 4px 0 6px; text-align: center; font-size: 12px; color: var(--muted); }
.ag-day { height: 36px; border: 0; border-radius: 0; background: none; color: var(--text); font-size: 14px; }
.ag-day.out { color: var(--dim); opacity: .5; }
.ag-day:hover { background: var(--hover); }
.ag-day.mid { background: var(--brand-soft); }
.ag-day.today { font-weight: 700; text-decoration: underline; }
.ag-day.edge { background: var(--brand); color: #fff; border-radius: 18px; }
.ag-cal-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 13px; }

@media (max-width: 1280px) {
  .ag-top { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .ag-board { grid-column: 1 / -1; grid-row: auto; min-height: 420px; }
  .ag-opps { grid-column: 1; grid-row: 1; } .ag-conv { grid-column: 2; grid-row: 1; } .ag-sms { grid-column: 1; grid-row: 2; } .ag-email { grid-column: 2; grid-row: 2; }
  .ag-call-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ag-bottom { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .ag-top, .ag-bottom, .ag-call-grid { grid-template-columns: minmax(0, 1fr); }
  .ag-opps, .ag-conv, .ag-sms, .ag-email, .ag-board { grid-column: 1; grid-row: auto; }
  .ag-card { padding: 20px 18px 16px; }
  .ag-card-title { font-size: 24px; }
  .ag-user-btn, .ag-range-text { min-width: 0; flex: 1; }
  .ag-controls, .ag-pick, .ag-dates { width: 100%; }
  .ag-user-menu { width: 100%; }
  .ag-totals { justify-content: flex-start; }
}
