/* ===== FORMS: ACCOUNTS OVERVIEW (frm-accounts.css) ===== */
/* Owned by forms.js's dedicated "Accounts" subview (the ROASform-style
   Subaccounts overview — every client with at least one form, worst/best-
   first, in one full-page table). Leans entirely on the frm-shared.css
   primitives (.frm-kpi, .frm-toolbar, .frm-btn, .frm-badge, the generic
   form-table component) and only adds this page's own layout + the
   Unique/All + date-range segmented controls — no duplicated primitives.
   Width-capped like the Finance tab (CLAUDE.md) so the KPI row and toolbar
   stay legible instead of stretching edge-to-edge on an ultrawide monitor;
   the table itself still scrolls horizontally inside its own wrapper below
   that cap, same as every other frm-table surface. */

.frm-acct {
  display: flex;
  flex-direction: column;
  gap: var(--s4);
  max-width: 1760px;
  margin-inline: auto;
}

/* ── header row (title + count pill + refresh) — reuses .frm-list-title /
      .frm-count from frm-list.css, same cross-subview convention the
      Dashboard already relies on (forms.js _renderDashboard) ── */
.frm-acct .frm-list-head {
  margin-bottom: 0;
}

/* ── KPI summary row (Total Accounts / Total Forms / Total Leads) ── */
.frm-acct-kpi {
  gap: var(--s3);
}
.frm-acct-kpi-top {
  display: flex;
  align-items: center;
  gap: var(--s3);
  min-width: 0;
}
.frm-acct-kpi-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: var(--r3);
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid color-mix(in srgb, currentColor 22%, transparent);
}
.frm-acct-kpi-badge .frm-ico {
  width: 18px;
  height: 18px;
  color: inherit;
}
.frm-acct-kpi-badge-accounts {
  color: var(--purple);
  background: color-mix(in srgb, var(--purple) 14%, transparent);
}
.frm-acct-kpi-badge-forms {
  color: var(--green);
  background: color-mix(in srgb, var(--green) 13%, transparent);
}
.frm-acct-kpi-badge-leads {
  color: var(--blue);
  background: var(--accent-dim);
}

/* ── toolbar: search + Unique/All toggle + date-range presets + Create ── */
.frm-acct-toolbar {
  margin-bottom: 0;
}
.frm-acct-searchwrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: 0 1 260px;
  min-width: 180px;
}
.frm-acct-search-ico {
  position: absolute;
  left: 11px;
  width: 15px;
  height: 15px;
  color: var(--text3);
  pointer-events: none;
}
.frm-acct-search {
  width: 100%;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--r2);
  color: var(--text);
  padding: 8px 12px 8px 34px;
  font-size: var(--fz-base);
  font-family: inherit;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
.frm-acct-search::placeholder {
  color: var(--text3);
}
.frm-acct-search:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

/* segmented control (Unique/All, date-range presets) — a row of pill buttons
   inside a track, active one lifted onto the accent color */
.frm-acct-segrow {
  display: inline-flex;
  gap: 2px;
  background: var(--chip);
  border: 1px solid var(--border2);
  border-radius: 999px;
  padding: 3px;
}
.frm-acct-seg {
  background: transparent;
  border: none;
  border-radius: 999px;
  color: var(--text2);
  padding: 5px 12px;
  font-size: var(--fz-sm);
  font-weight: var(--fw-semibold);
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background 0.15s,
    color 0.15s;
}
.frm-acct-seg:hover {
  color: var(--text);
}
.frm-acct-seg-on,
.frm-acct-seg-on:hover {
  background: var(--accent);
  color: #fff;
}

/* range-unavailable fallback note (7/30/90 fetch failed — All Time is shown
   instead rather than a fabricated filter) */
.frm-acct-note {
  display: flex;
  align-items: center;
  gap: var(--s2);
  background: color-mix(in srgb, var(--gold) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--gold) 30%, transparent);
  border-radius: var(--r3);
  color: var(--text2);
  padding: var(--s3) var(--s4);
  font-size: var(--fz-sm);
}

/* ── table (form-table.js markup; base styling from frm-shared.css) ──
   The toolbar's own search box proxies into the table's real search input,
   same pattern as .frm-list — hide the duplicate. */
.frm-acct .frm-table-search {
  display: none;
}
/* numeric metric + rate columns (2–9) read right-aligned + tabular */
.frm-acct .frm-table-el th:nth-child(n + 2):nth-child(-n + 9),
.frm-acct .frm-table-el td:nth-child(n + 2):nth-child(-n + 9) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
/* pin the Actions column to the right edge, same tucked-behind treatment as
   the List subview's row actions */
.frm-acct .frm-table-el th:last-child,
.frm-acct .frm-table-el td:last-child {
  position: sticky;
  right: 0;
  background: var(--card);
  border-left: 1px solid var(--border);
  box-shadow: -10px 0 10px -8px rgba(0, 0, 0, 0.35);
  padding-right: var(--s4);
  z-index: 1;
}
.frm-acct .frm-table-el th:last-child {
  z-index: 2;
}
.frm-acct .frm-table-el tr.frm-table-row:hover td:last-child {
  background: var(--card-hover);
}
.frm-acct .frm-table-el tr.frm-table-row .frm-act {
  opacity: 0.55;
}
.frm-acct .frm-table-el tr.frm-table-row:hover .frm-act,
.frm-acct .frm-table-el tr.frm-table-row:focus-within .frm-act {
  opacity: 1;
}

/* ── responsive ── */
@media (max-width: 640px) {
  .frm-acct-searchwrap {
    flex: 1 1 100%;
    min-width: 0;
  }
  .frm-acct-toolbar {
    align-items: stretch;
  }
  .frm-acct-segrow {
    flex: 1 1 auto;
    justify-content: space-between;
  }
  .frm-acct-seg {
    flex: 1 1 auto;
    text-align: center;
  }
}
