/* ══ Fundy — Agent Pro (js/x-agent-pro.js) ══ */
.agp-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: var(--sp-gap, 14px); }
.agp-tabs .seg-btn { display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; }
.agp-dot { font-style: normal; min-width: 15px; height: 15px; padding: 0 4px; font-size: 9.5px; line-height: 15px; text-align: center; background: var(--green); color: #04130c; }
.agp-bar-r { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.agp-day { font-family: var(--mono); font-size: 11px; color: var(--text-3); }
.agp-view { min-height: 400px; }
.agp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: var(--sp-gap, 14px); align-items: start; }
.agp-2col { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: var(--sp-gap, 14px); align-items: start; }
.agp-2col > div { display: flex; flex-direction: column; gap: var(--sp-gap, 14px); min-width: 0; }
.agp-card .ag-h .muted { margin-left: auto; font-weight: 400; font-size: 10.5px; }
.agp-empty { padding: 10px 0; font-size: 12px; }
.agp-t { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border-dim); font-size: 12px; }
.agp-t > span:first-child { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.agp-t b { font-weight: 600; }
.agp-t em { font-style: normal; font-size: 10.5px; color: var(--text-3); }
.agp-n { width: 118px; height: 28px; flex-shrink: 0; }
.agp-n input { width: 100%; font-family: var(--mono); font-size: 12px; }
.agp-t .seg { flex-shrink: 0; }
.agp-t select { width: auto; }
.agp-seg .seg-btn { padding: 0 9px; }
.agp-lad { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 4px; }
.agp-lad span { display: flex; flex-direction: column; align-items: center; min-width: 52px; padding: 6px 8px; border: 1px solid rgba(var(--green-rgb), .35); background: rgba(var(--green-rgb), .06); font-family: var(--mono); font-size: 10.5px; color: var(--text-2); }
.agp-lad span b { font-weight: 400; color: var(--green); font-size: 12px; }
.agp-lad .mb { border-color: var(--border-2); background: var(--surface-2); }
.agp-lad .mb b { color: var(--text); }
.agp-meter { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 11px; color: var(--text-3); }
.agp-meter span { width: 80px; }
.agp-meter b { font-family: var(--mono); font-weight: 400; white-space: nowrap; color: var(--text-2); }
.ag-bar.red i { background: var(--red); }

/* composer */
.agp-comp { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border-dim); }
.agp-row { display: flex; align-items: center; gap: 8px; font-size: 11.5px; }
.agp-row > label:first-child { width: 58px; flex-shrink: 0; color: var(--text-3); }
.agp-row .inp-sm { flex: 1; min-width: 0; height: 28px; }
.agp-row .muted { font-size: 10.5px; white-space: nowrap; }
.agp-ck { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; color: var(--text-2); cursor: pointer; }
.agp-tick { flex-wrap: wrap; }
.agp-tick button { height: 22px; padding: 0 7px; font-family: var(--mono); font-size: 10.5px; border: 1px solid var(--border-2); color: var(--text-2); }
.agp-tick button:hover { color: var(--text); border-color: var(--border-3); }
.agp-intent { display: flex; flex-wrap: wrap; gap: 4px; font-size: 10.5px; }
.agp-intent.muted { color: var(--text-4); }
.agp-intent span { display: inline-flex; gap: 4px; padding: 2px 6px; background: var(--surface-2); border: 1px solid var(--border-dim); font-family: var(--mono); }
.agp-intent em { font-style: normal; color: var(--text-4); }
.agp-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.agp-presets { display: flex; flex-wrap: wrap; gap: 5px; }
.agp-presets span { display: inline-flex; align-items: center; border: 1px solid var(--border-2); background: var(--surface-2); }
.agp-presets button { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 7px; font-size: 10.5px; color: var(--text-2); }
.agp-presets i { display: inline-flex; padding: 0 5px; color: var(--text-4); cursor: pointer; }
.agp-presets i:hover { color: var(--red); }

/* run card */
.agp-stc { display: inline-flex; margin-left: auto; gap: 2px; }
.agp-stc button { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; color: var(--text-3); border: 1px solid var(--border-dim); }
.agp-stc button:hover { color: var(--text); border-color: var(--border-3); }
.agp-mt { display: flex; flex-wrap: wrap; gap: 4px; margin: 10px 0 0; }
.agp-mt span { padding: 1px 7px; font-family: var(--pixel); font-size: 9.5px; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); border: 1px solid var(--border-2); }
.agp-mt span.tg { color: #b69cff; border-color: rgba(182, 156, 255, .35); text-transform: none; }
.agp-addtag { display: inline-flex; align-items: center; gap: 3px; padding: 0 6px; font-size: 10px; color: var(--text-4); border: 1px dashed var(--border-2); }
.agp-addtag:hover { color: var(--text); }
.agp-chart { margin: 12px 0 0; padding: 10px; border: 1px solid var(--border-dim); background: var(--surface-2); }
.agp-chart svg { width: 100%; height: 90px; display: block; }
.agp-chart-l { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; font-family: var(--mono); font-size: 10px; }
.agp-proj, .agp-fees { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin-top: 10px; font-size: 11px; color: var(--text-3); }
.agp-proj .btn { margin-left: auto; }
.agp-note { width: 100%; min-height: 34px; margin-top: 10px; padding: 7px 10px; font-size: 11.5px; resize: vertical; }
.agp-logbar { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.agp-logbar .seg { overflow-x: auto; }
.agp-logbar .seg-btn { padding: 0 7px; font-size: 10.5px; }
.agp-logbar .inp-sm { height: 26px; }

/* triggers & automations */
.agp-trg { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border-dim); }
.agp-trg.off { opacity: .5; }
.agp-trg-ic { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; flex-shrink: 0; border: 1px solid var(--border-2); background: var(--surface-2); }
.agp-trg b { display: block; font-size: 12px; }
.agp-trg .grow > span { font-size: 10.5px; color: var(--text-3); }
.agp-trg em { font-style: normal; color: var(--text); }
.agp-new { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.agp-new .inp-sm { height: 30px; width: auto; flex: 1 1 110px; min-width: 90px; }
.agp-new input[type=number] { flex: 0 0 70px; }
.agp-tgc { display: flex; gap: 6px; }
.agp-tgc .inp-sm { flex: 1; height: 30px; }
.agp-out, .agp-feed { display: flex; flex-direction: column; margin-top: 10px; max-height: 320px; overflow-y: auto; }
.agp-out div, .agp-feed div { display: flex; align-items: baseline; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--border-dim); font-size: 11.5px; color: var(--text-2); }
.agp-out span { flex-shrink: 0; padding: 0 5px; font-family: var(--pixel); font-size: 9px; background: rgba(42, 171, 238, .15); color: #5ab8f0; }
.agp-out span.me { background: var(--surface-3); color: var(--text); }
.agp-out span.hook { background: rgba(182, 156, 255, .15); color: #b69cff; }
.agp-out em, .agp-feed em { margin-left: auto; flex-shrink: 0; font-style: normal; font-size: 10px; color: var(--text-4); }
.agp-feed b { font-weight: 500; }
.agp-chk { display: flex; flex-wrap: wrap; gap: 8px 14px; padding: 10px 0; font-size: 11.5px; }
.agp-chk label { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }

/* analytics */
.agp-an-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.agp-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1px; margin-bottom: var(--sp-gap, 14px); background: var(--border); border: 1px solid var(--border); }
.agp-kpis.sm { grid-template-columns: repeat(5, 1fr); margin: 10px 0; }
.agp-kpi { padding: 12px 14px; background: var(--surface); min-width: 0; }
.agp-kpi span { display: block; font-size: 10.5px; color: var(--text-3); margin-bottom: 4px; }
.agp-kpi b { display: block; font-family: var(--mono); font-weight: 400; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agp-kpi small { font-size: 10px; color: var(--text-3); }
.agp-eq { width: 100%; height: 80px; display: block; }
.agp-tbl td, .agp-tbl th { height: 32px !important; padding: 0 8px !important; font-size: 11.5px; }
.agp-tbl .r { text-align: right; font-family: var(--mono); }
.agp-bt { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.agp-bt .inp-sm { height: 30px; width: auto; }
.agp-bt input { width: 80px !important; }
.agp-hist { display: flex; align-items: flex-end; gap: 3px; height: 70px; margin-top: 8px; }
.agp-hist i { flex: 1; min-height: 2px; background: rgba(var(--green-rgb), .55); }
.agp-hist i.r { background: rgba(var(--red-rgb), .55); }

/* profiles */
.agp-pf.on { border-color: var(--text-3); }
.agp-pf-kv { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; margin-bottom: 12px; font-size: 11px; }
.agp-pf-kv span { display: block; color: var(--text-3); font-size: 10px; }
.agp-pf-kv b { font-family: var(--mono); font-weight: 400; }
.agp-pf-new { display: flex; flex-direction: column; gap: 8px; }
.agp-pf-new p { margin: 0; font-size: 11.5px; line-height: 1.5; }
.agp-addst .menu-item { width: 100%; }

/* replay */
.agp-scrub { width: 100%; margin-bottom: 12px; accent-color: var(--text); }
.agp-rep-now { padding: 12px; border: 1px solid var(--border-2); background: var(--surface-2); }
.agp-rep-now span { font-family: var(--pixel); font-size: 10px; text-transform: uppercase; color: var(--text-3); margin-right: 8px; }
.agp-rep-now b { font-family: var(--mono); font-weight: 400; }
.agp-rep-now p { margin: 6px 0 0; font-size: 12.5px; }
.agp-rep-list { margin-top: 10px; }
.agp-rep-list div { display: flex; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border-dim); font-size: 11.5px; color: var(--text-3); }
.agp-rep-list div.on { color: var(--text); }
.agp-rep-list em { font-style: normal; font-family: var(--mono); width: 56px; flex-shrink: 0; }

@media (max-width: 1100px) { .agp-2col { grid-template-columns: 1fr; } .agp-kpis.sm { grid-template-columns: repeat(3, 1fr); } }

/* ── tight, aligned card layout: equal-height rows, one gap everywhere, columns that end together ── */
.dash-agent { --agp-gap: 12px; }
.agp-bar { margin-bottom: var(--agp-gap); }
.agp-view { min-height: 0; }
.agp-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--agp-gap); align-items: stretch; }
.agp-grid > .ag-card, .agp-2col > div > .ag-card { display: flex; flex-direction: column; margin: 0; }
.agp-2col { gap: var(--agp-gap); align-items: stretch; }
.agp-2col > div { gap: var(--agp-gap); }
.agp-2col > div > .ag-card:last-child { flex: 1; }
.agp-card, .agp-pf { padding: 14px 16px; }
.agp-card .ag-h, .agp-pf .ag-h { margin-bottom: 8px; }
.agp-card > .agp-t:last-child, .agp-card > label:last-child { border-bottom: 0; padding-bottom: 0; }
.agp-view > .ag-card { margin-top: var(--agp-gap); }
.agp-view > .ag-card:first-child, .agp-view > .agp-an-top + .agp-kpis { margin-top: 0; }
.agp-view > .agp-grid + .ag-card, .agp-view > .ag-card + .agp-grid, .agp-view > .agp-kpis + .ag-card, .agp-view > .agp-kpis + .agp-grid { margin-top: var(--agp-gap); }
.agp-view > .agp-grid + .agp-grid { margin-top: var(--agp-gap); }
/* KPI strip: columns always divide the 9 tiles evenly, so no empty cells */
.agp-kpis { grid-template-columns: repeat(9, minmax(0, 1fr)); margin-bottom: 0; }
.agp-kpis.sm { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1500px) { .agp-kpis:not(.sm) { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) { .agp-kpis:not(.sm), .agp-kpis.sm { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.agp-an-top { margin-bottom: var(--agp-gap); }
/* profiles: cards share a height; "new profile" becomes a full-width strip */
.agp-pf .agp-btns { margin-top: auto; }
.agp-pf-new { grid-column: 1 / -1; flex-direction: row !important; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.agp-pf-new .ag-h { margin: 0; }
.agp-pf-new p { flex: 1 1 260px; }
.agp-pf-new .inp-sm { flex: 0 1 220px; height: 30px; }
/* runs view: the three columns start and stretch together */
.dash-agent .ag { gap: var(--agp-gap); align-items: stretch; }
.dash-agent .ag-col { gap: var(--agp-gap); }
.dash-agent .ag-col > .ag-card:last-child { flex: 1; }
.dash-agent .ag-left > .ag-card, .dash-agent .ag-right > .ag-card { display: flex; flex-direction: column; }
.dash-agent .ag-mid > .ag-card, .dash-agent .ag-mid > .ag-empty { flex: 1; }
.dash-agent .ag-kill { margin-top: auto; }
.dash-agent .ag-left > .ag-card:last-child .ag-pads { margin-bottom: 14px; }
.dash-agent .ag-logcard { flex: 0 0 auto !important; }
.dash-agent .ag-log { max-height: 420px; }
