/* Client Portal (staff view) — css/portal-admin.css
   ═══════════════════════════════════════════════════════════════════════════
   Extracted from an inline <style> block in plugins/portal-admin.html, which
   is why this tool looked like a different product: that block hardcoded its
   own orange (#f26522), its own borders (rgba(0,0,0,0.2)) and its own pills,
   none of which flip under body.dark-mode, and set no max-width at all so the
   cards ran the full width of the monitor.

   Everything here is tokens from css/variables.css — they already flip for
   dark mode, so almost nothing needs a per-theme variant. Button vocabulary
   matches .proc-btn / .ag-btn (see css/procedures.css, css/insurance-agent.css).

   No @keyframes in this file — those live in css/animations.css. */

/* ── Layout ───────────────────────────────────────────────────────────────
   1100px rather than the generic 1400px cap in css/layout.css: this tool is a
   search box and a 4-column table, and at full width the "when" column ends up
   a screen away from the "what".

   Scoped to #portalAdminTool ON PURPOSE. The generic constraint is
   `.plugin-container > main:not(.ia-main)` — specificity (0,2,1) — so a bare
   `.pa-main` (0,1,0) loses to it no matter which stylesheet loads last, and the
   cap would silently stay at 1400px. */
#portalAdminTool .pa-main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 16px 24px 48px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.pa-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px 20px;
}

.pa-card-head {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 2px;
}
.pa-card-head h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

.pa-hint {
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-secondary);
    margin: 6px 0 12px;
}

/* ── Controls ─────────────────────────────────────────────────────────── */

.pa-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.pa-input {
    flex: 1 1 14rem;
    min-width: 0;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
}
.pa-input::placeholder { color: var(--text-secondary); opacity: 0.8; }
.pa-input:focus {
    outline: none;
    border-color: var(--apple-blue);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
}
.pa-input-narrow { flex: 0 0 6rem; }

.pa-btn {
    flex: 0 0 auto;
    padding: 9px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s var(--transition-smooth);
}
.pa-btn:hover:not(:disabled) {
    border-color: var(--border-strong);
    background: var(--bg-widget-hover);
}
.pa-btn:disabled { opacity: 0.6; cursor: default; }

/* --accent-on-fill is the blue tuned to sit BEHIND white text (see the note in
   css/variables.css); --apple-blue used as a fill under white is under AA. */
.pa-btn-primary {
    background: var(--accent-on-fill);
    border-color: var(--accent-on-fill);
    color: #fff;
}
.pa-btn-primary:hover:not(:disabled) {
    background: var(--apple-blue-hover);
    border-color: var(--apple-blue-hover);
}

.pa-btn-danger { color: var(--danger); border-color: var(--danger); }
.pa-btn-danger:hover:not(:disabled) {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

.pa-btn-compact { padding: 5px 11px; font-size: 12px; }

/* ── Live indicator ───────────────────────────────────────────────────────
   Says when the feed last updated. Deliberately text, not a blinking dot: the
   useful fact is the timestamp, and a dot that pulses forever stops meaning
   anything. Reads "Loading…" until the first response lands — never a
   fabricated time, and never a green dot before anything has been fetched. */
.pa-live {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
}
.pa-live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
    flex: 0 0 auto;
}
.pa-live[data-state="paused"] .pa-live-dot { background: var(--text-secondary); }
.pa-live[data-state="error"]  .pa-live-dot { background: var(--danger); }

/* ── Results ──────────────────────────────────────────────────────────── */

.pa-result { margin-top: 14px; }
.pa-empty { font-size: 13px; color: var(--text-secondary); }
.pa-error { font-size: 13px; color: var(--danger); }

.pa-scroll { overflow-x: auto; }

.pa-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    color: var(--text);
}
.pa-table th,
.pa-table td {
    text-align: left;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}
.pa-table th {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    font-weight: 700;
}
.pa-table tbody tr:last-child td { border-bottom: none; }

.pa-pill {
    display: inline-block;
    padding: 2px 9px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.pa-pill-on {
    background: rgba(52, 199, 89, 0.15);
    color: var(--success-text);
}
.pa-pill-off {
    background: var(--bg-input);
    color: var(--text-secondary);
}

.pa-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
    white-space: nowrap;
}

/* ── "New since you last looked" ──────────────────────────────────────────
   The highlight is measured against a watermark captured when the tool opened,
   NOT against the live one — otherwise the first auto-refresh would quietly
   un-highlight the rows the operator is in the middle of reading. */
.pa-new-banner {
    margin: 0 0 10px;
    padding: 8px 12px;
    border: 1px solid var(--warning);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--warning-text);
    font-size: 13px;
    font-weight: 600;
}
.pa-row-new td { background: var(--bg-widget-hover); }
.pa-row-new td:first-child { box-shadow: inset 3px 0 0 var(--warning); }

/* ── Client picker (name search resolved to more than one record) ─────── */

.pa-picker { margin-top: 12px; }
.pa-picker-lede {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0 0 8px;
}
.pa-picker-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.pa-picker-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    align-items: baseline;
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s var(--transition-smooth);
}
.pa-picker-row:hover {
    border-color: var(--apple-blue);
    background: var(--bg-widget-hover);
}
.pa-picker-name { font-weight: 600; }
.pa-picker-meta { color: var(--text-secondary); font-size: 12px; }

/* ── Narrow screens ───────────────────────────────────────────────────── */

@media (max-width: 767px) {
    #portalAdminTool .pa-main { padding: 12px 14px 40px; }
    .pa-card { padding: 14px 14px 16px; }
    .pa-input { flex-basis: 100%; }
    .pa-input-narrow { flex: 1 1 5rem; }
    .pa-btn { flex: 1 1 auto; }
}
