/* ============================================================
   Agency (v2) — theme + layout khởi tạo. Dark, thương hiệu PinkAGC (hồng), điểm nhấn vàng nhẹ.
   Chỉ là KHUNG: đủ để duyệt bố cục, chưa phải bản hoàn thiện.
   ============================================================ */
:root {
  --bg:            #0f0d12;
  --bg-panel:      #171319;
  --bg-elev:       #1e1922;
  --bg-hover:      #241d29;
  --border:        #2c2530;
  --text:          #efe9f2;
  --text-dim:      #a99fb2;
  --text-mute:     #6f6577;
  --accent:        #ff4f9a;   /* hồng PinkAGC */
  --accent-soft:   rgba(255,79,154,0.14);
  --accent-border: rgba(255,79,154,0.42);
  --gold:          #e8c07a;   /* điểm nhấn vàng nhẹ kiểu premium */
  --ok:            #34d399;
  --warn:          #fbbf24;
  --danger:        #f26d6d;
  --radius:        10px;
  font-family: "Roboto", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
button, input, select, textarea { font-family: inherit; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font-size: 13px; }

#ag-app { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

/* ---------- Header ---------- */
.ag-header {
  height: 54px; flex: 0 0 54px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px;
  background: linear-gradient(180deg, #1b1620, #141018);
  border-bottom: 1px solid var(--border);
}
.ag-brand { display: flex; align-items: center; gap: 9px; }
.ag-logo-img { width: 30px; height: 30px; border-radius: 8px; display: block; object-fit: contain; background: #fff; }
.ag-name { font-size: 17px; font-weight: 800; letter-spacing: .2px; }
.ag-name b { color: var(--accent); }
.ag-tagline {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px;
  color: var(--gold); border: 1px solid rgba(232,192,122,.4); padding: 2px 7px; border-radius: 20px;
}
.ag-ver { font-size: 11px; color: var(--text-mute); }
.ag-header-right { display: flex; align-items: center; gap: 12px; }
.ag-badge { font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 20px; }
.ag-badge-warn { color: var(--warn); background: rgba(251,191,36,.12); border: 1px solid rgba(251,191,36,.35); }
.ag-badge-ok   { color: var(--ok);   background: rgba(52,211,153,.12); border: 1px solid rgba(52,211,153,.35); }
.ag-badge-plan { color: var(--gold); background: rgba(232,192,122,.1);  border: 1px solid rgba(232,192,122,.3); }
.ag-user { font-size: 12px; color: var(--text-dim); }

/* ---------- Body 3 cột ---------- */
.ag-body { flex: 1 1 auto; display: grid; grid-template-columns: 54px 1fr 340px; min-height: 0; }
.ag-body.has-pipeline { grid-template-columns: 54px 1fr 300px 340px; }

/* Rail icon trái */
.ag-rail {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 0;
  background: var(--bg-panel); border-right: 1px solid var(--border);
}
.ag-rail-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 0; cursor: pointer;
  background: transparent; color: var(--text-dim); font-size: 17px; transition: .15s;
}
.ag-rail-btn:hover { background: var(--bg-hover); color: var(--text); }
.ag-rail-btn.active { background: var(--accent-soft); color: var(--accent); }

/* ---------- Trung tâm ---------- */
.ag-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }

.ag-tabs { display: flex; gap: 6px; padding: 12px 16px 0; }
.ag-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border: 1px solid var(--border); border-bottom: 0;
  border-radius: 10px 10px 0 0; background: var(--bg-panel);
  color: var(--text-dim); font-size: 13px; font-weight: 600; cursor: pointer; transition: .15s;
}
.ag-tab:hover { color: var(--text); }
.ag-tab.active { background: var(--bg-elev); color: var(--accent); border-color: var(--accent-border); }
.ag-count {
  font-size: 11px; font-weight: 700; min-width: 18px; text-align: center;
  padding: 1px 6px; border-radius: 20px; background: rgba(255,255,255,.06); color: var(--text-dim);
}
.ag-tab.active .ag-count { background: var(--accent-soft); color: var(--accent); }

/* ---------- Con truot "liquid" sau tab (phuong an A) ----------
   Chay bang transform nen khong gay reflow; chu nam tren nen khong bi nhoe. */
.ag-tabs { position: relative; }
.ag-tab  { position: relative; z-index: 1; }
.ag-tab.active { background: transparent; }
.ag-slider {
  position: absolute; top: 12px; left: 0; height: calc(100% - 12px);
  background: var(--bg-elev); border: 1px solid var(--accent-border); border-bottom: 0;
  border-radius: 10px 10px 0 0; z-index: 0; pointer-events: none; opacity: 0;
  transform-origin: left center; will-change: transform, width;
}
.ag-slider::after {
  content: ""; position: absolute; left: 10px; right: 10px; top: -1px; height: 2px;
  background: var(--accent); border-radius: 2px; box-shadow: 0 0 10px rgba(255,79,154,.7);
}
/* Nut hanh dong canh dai tab - KHONG phai .ag-tab nen con truot khong chay toi day */
.ag-tab-action {
  align-self: flex-end; margin: 0 0 4px 10px; z-index: 1;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 8px; white-space: nowrap; flex: 0 0 auto;
  border: 1px solid var(--accent-border); background: var(--accent-soft); color: var(--accent);
  font-family: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; transition: .15s;
}
.ag-tab-action:hover:not(:disabled) { background: rgba(255,79,154,.22); }
.ag-tab-action:disabled { opacity: .65; cursor: progress; }
@media (prefers-reduced-motion: reduce) { .ag-slider { transition: none !important; } }

/* ---------- Nut phu canh dai tab (kieu tram hon nut chinh) ---------- */
.ag-tab-action-quiet {
  border-color: var(--border); background: var(--bg-panel); color: var(--text-dim);
}
.ag-tab-action-quiet:hover:not(:disabled) { background: var(--bg-hover); color: var(--text); border-color: var(--text-mute); }

/* ---------- Bang tuy chinh cot ---------- */
#ag-cols-panel {
  position: fixed; z-index: 9999; width: 300px;
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 14px 40px rgba(0,0,0,.6); overflow: hidden;
  font-family: inherit; color: var(--text);
}
.acp-head {
  display: flex; align-items: center; gap: 8px; padding: 12px 14px;
  border-bottom: 1px solid var(--border); background: var(--bg-elev);
}
.acp-title { font-size: 13px; font-weight: 700; margin-right: auto; }
.acp-count {
  font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 20px;
  background: var(--accent-soft); color: var(--accent); font-variant-numeric: tabular-nums;
}
.acp-list { overflow-y: auto; padding: 6px; }
.acp-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border-radius: 8px; cursor: grab; user-select: none;
  transition: background-color .12s ease;
}
.acp-row:hover { background: var(--bg-hover); }
.acp-row.locked { cursor: default; opacity: .45; }
.acp-row.locked:hover { background: transparent; }
.acp-row.acp-dragging { opacity: .4; background: var(--accent-soft); }
.acp-grip { width: 12px; color: var(--text-mute); font-size: 12px; line-height: 1; }
.acp-name { flex: 1; font-size: 13px; }
.acp-cb { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }
.acp-row.locked .acp-cb { cursor: default; }
.acp-foot {
  display: flex; gap: 8px; padding: 10px 12px;
  border-top: 1px solid var(--border); background: var(--bg-elev);
}
.acp-btn {
  flex: 1; padding: 9px 12px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--border); background: var(--bg-panel); color: var(--text-dim);
  font-family: inherit; font-size: 12px; font-weight: 600; transition: .15s;
}
.acp-btn:hover { background: var(--bg-hover); color: var(--text); }
.acp-btn.acp-primary {
  border-color: var(--accent-border); background: var(--accent-soft); color: var(--accent);
}
.acp-btn.acp-primary:hover { background: rgba(255,79,154,.22); }

.ag-toolbar {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  background: var(--bg-elev); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.ag-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg-panel); color: var(--text); font-size: 12.5px; font-weight: 600; cursor: pointer; transition: .15s;
}
.ag-btn:hover { background: var(--bg-hover); border-color: var(--text-mute); }
.ag-btn-primary { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-border); }
.ag-btn.ag-icon { padding: 8px 10px; }
.ag-search-wrap { flex: 1; display: flex; align-items: center; gap: 8px; padding: 0 12px;
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: 8px; }
.ag-search-ic { color: var(--text-mute); font-size: 12px; }
.ag-search { flex: 1; background: transparent; border: 0; outline: 0; color: var(--text); font-size: 13px; padding: 8px 0; }
.ag-search::placeholder { color: var(--text-mute); }

.ag-table-wrap { flex: 1 1 auto; overflow: auto; min-height: 0; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
/* scrollbar gọn, mượt (giống SMIT) */
.ag-table-wrap::-webkit-scrollbar { width: 10px; height: 10px; }
.ag-table-wrap::-webkit-scrollbar-thumb { background: rgba(255,255,255,.16); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
.ag-table-wrap::-webkit-scrollbar-thumb:hover { background: rgba(255,79,154,.5); background-clip: content-box; }
.ag-table-wrap::-webkit-scrollbar-track { background: transparent; }
.ag-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.ag-table thead th {
  position: sticky; top: 0; z-index: 1; text-align: left; font-weight: 700; color: var(--text-dim);
  padding: 7px 9px; background: var(--bg-panel); border-bottom: 1px solid var(--border); white-space: nowrap;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .3px;
}
.ag-table tbody td { padding: 6px 9px; border-bottom: 1px solid var(--border); white-space: nowrap; }
/* cột tên: cho phép rút gọn nếu quá dài, khỏi kéo ngang */
.ag-cell-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.ag-table tbody tr:hover { background: var(--bg-hover); }
.ag-table tbody tr { cursor: pointer; }
.ag-table tbody.ag-dragging { user-select: none; }   /* kéo chọn nhiều dòng: không bôi đen chữ */
.ag-table tbody tr.sel { background: var(--accent-soft); }
.ag-table tbody tr.sel:hover { background: var(--accent-soft); }
.ag-table tbody tr.ag-empty { cursor: default; }
.ag-col-cb { width: 40px; }
/* ghim cột chọn khi kéo NGANG — luôn thấy ô tick dù bảng rộng */
.ag-table thead th.ag-col-cb { position: sticky; left: 0; z-index: 3; background: var(--bg-panel); }
.ag-table tbody td.ag-col-cb { position: sticky; left: 0; z-index: 1; background: var(--bg); }
.ag-table tbody tr:hover td.ag-col-cb { background: var(--bg-hover); }
.ag-table tbody tr.sel td.ag-col-cb { background: var(--accent-soft); }
.ag-empty td { text-align: center; color: var(--text-mute); padding: 40px 14px; }

/* pill trạng thái xanh/đỏ/xám (giống pinkagc extensions) */
.ag-st { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; white-space: nowrap; }
.ag-st::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 6px currentColor; }
.ag-st-on  { color: var(--ok); }
.ag-st-off { color: var(--danger); }
.ag-st-na  { color: var(--text-mute); }
.ag-st-na::before { box-shadow: none; }
/* nút Tải dữ liệu: số lượng + thời gian cập nhật */
#ag-load b { color: var(--accent); font-weight: 800; }

/* badge thương hiệu thẻ (Visa/MC/Amex…) giống SMIT */
.ag-card { display: inline-block; padding: 2px 6px; border-radius: 4px; font-size: 9.5px; font-weight: 800;
  letter-spacing: .4px; color: #fff; line-height: 1.3; vertical-align: middle; }
.ag-card-visa { background: #1a1f71; }
.ag-card-mc   { background: #eb001b; }
.ag-card-amex { background: #2e77bc; }
.ag-card-disc { background: #f28020; }
.ag-card-jcb  { background: #0b4ea2; }
.ag-card-up   { background: #e21836; }
.ag-card-pp   { background: #003087; }
.ag-card-num  { font-weight: 700; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.ag-cell-card { white-space: nowrap; }
.ag-dim { color: var(--text-mute); }

/* ô tiền tệ + quốc gia cho Đặt giới hạn */
.ag-pl-cur { margin-top: 8px; padding: 8px 10px; border-radius: 8px; font-size: 12px; line-height: 1.4;
  background: var(--accent-soft); border: 1px solid var(--accent-border); color: var(--text); }
.ag-pl-cur b { color: var(--accent); }

/* info box "Đã bật - không cần cấu hình" cho feature không có tham số */
.ag-pl-note { margin-top: 4px; padding: 10px 12px; border-radius: 8px; font-size: 12px; line-height: 1.5;
  background: rgba(52,211,153,.10); border: 1px solid rgba(52,211,153,.35); color: var(--text-dim); }
.ag-pl-note b { color: var(--ok); }

/* Menu Hành động (3 cột + phím tắt) — học bản APP */
#ag-actmenu { position: fixed; z-index: 9998; display: flex; gap: 18px; padding: 16px 18px;
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 18px 50px rgba(0,0,0,.55); max-width: 94vw; }
#ag-actmenu[hidden] { display: none !important; }   /* thuộc tính hidden phải thắng display:flex */
.ag-am-col { min-width: 220px; }
.ag-am-title { font-size: 10.5px; font-weight: 800; letter-spacing: .8px; text-transform: uppercase;
  color: var(--accent); text-align: center; padding-bottom: 8px; margin-bottom: 6px; border-bottom: 1px solid var(--border); }
.ag-am-item { width: 100%; display: flex; align-items: center; gap: 9px; padding: 8px 10px; border: 0; border-radius: 9px;
  background: transparent; color: var(--text); font-size: 13px; cursor: pointer; text-align: left; }
.ag-am-item:hover { background: var(--accent-soft); }
.ag-am-ico { width: 18px; text-align: center; flex: 0 0 18px; }
.ag-am-label { flex: 1 1 auto; white-space: nowrap; }
.ag-am-keys { flex: 0 0 auto; font-size: 10.5px; color: var(--text-mute); background: var(--bg); border: 1px solid var(--border);
  border-radius: 5px; padding: 2px 6px; font-family: ui-monospace, Menlo, Consolas, monospace; }
@media (max-width: 820px) { #ag-actmenu { flex-direction: column; gap: 10px; } }

/* ô ID: bôi đen được + bấm để copy */
.ag-copy { cursor: copy; user-select: text; font-variant-numeric: tabular-nums; }
.ag-copy:hover { color: var(--accent); text-decoration: underline dotted; }
.ag-ext { color: var(--gold); text-decoration: none; font-weight: 700; margin-left: 4px; cursor: pointer; }
.ag-ext:hover { color: var(--accent); }
/* toast copy */
#ag-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(12px);
  background: #111; color: #fff; border: 1px solid var(--accent-border); padding: 8px 14px; border-radius: 8px;
  font-size: 12.5px; font-weight: 600; box-shadow: 0 8px 24px rgba(0,0,0,.5); opacity: 0; pointer-events: none;
  transition: opacity .18s, transform .18s; z-index: 9999; max-width: 80vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#ag-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.ag-footer {
  flex: 0 0 auto; display: flex; align-items: center; gap: 10px; padding: 10px 16px;
  background: var(--bg-panel); border-top: 1px solid var(--border); font-size: 12px; color: var(--text-dim);
}
.ag-footer b { color: var(--text); }
.ag-sep { color: var(--text-mute); }

/* ---------- Workflow phải ---------- */
.ag-workflow { display: flex; flex-direction: column; background: var(--bg-panel); border-left: 1px solid var(--border); min-height: 0; }
.ag-wf-head { padding: 14px 14px 10px; border-bottom: 1px solid var(--border); }
.ag-wf-title { display: block; font-size: 13px; font-weight: 800; color: var(--gold); margin-bottom: 10px; }
.ag-wf-search { width: 100%; padding: 8px 12px; background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 12.5px; outline: 0; }
.ag-wf-search::placeholder { color: var(--text-mute); }
.ag-wf-body { flex: 1 1 auto; overflow: auto; padding: 10px; min-height: 0; }

.ag-wf-group { margin-bottom: 12px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.ag-wf-group-head {
  display: flex; align-items: center; justify-content: space-between; cursor: pointer;
  padding: 10px 12px; background: var(--bg-elev); font-size: 12.5px; font-weight: 700;
}
.ag-wf-group-head .ag-dot { color: var(--accent); margin-right: 7px; }
.ag-wf-group-count { font-size: 11px; font-weight: 700; color: var(--text-mute); }
.ag-wf-item {
  display: flex; align-items: center; gap: 9px; padding: 10px 12px;
  border-top: 1px solid var(--border); font-size: 12.5px; color: var(--text-dim); cursor: pointer; transition: .15s;
}
.ag-wf-item:hover { background: var(--bg-hover); color: var(--text); }
.ag-wf-item .ag-wf-ico { width: 16px; text-align: center; opacity: .85; }
.ag-wf-item .ag-wf-toggle { width: 34px; height: 18px; border-radius: 20px;
  background: var(--border); position: relative; flex: 0 0 auto; transition: .15s; }
.ag-wf-item.on .ag-wf-toggle { background: var(--accent); }
.ag-wf-item .ag-wf-toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px;
  border-radius: 50%; background: #fff; transition: .15s; }
.ag-wf-item.on .ag-wf-toggle::after { left: 18px; }

/* Workflow — nhóm gập được + handle + chevron + info */
.ag-wf-group-head { user-select: none; }
.ag-wf-group-name { display: inline-flex; align-items: center; }
.ag-wf-group-right { display: inline-flex; align-items: center; gap: 8px; }
.ag-wf-chevron { color: var(--text-mute); font-size: 10px; transition: transform .15s; }
.ag-wf-group.collapsed .ag-wf-items { display: none; }
.ag-wf-group.collapsed .ag-wf-chevron { transform: rotate(180deg); }
.ag-wf-handle { color: var(--text-mute); cursor: grab; font-size: 12px; opacity: .7; }
.ag-wf-name { flex: 1; }
.ag-wf-info { color: var(--text-mute); font-size: 12px; opacity: .8; }
.ag-wf-info:hover { color: var(--accent); }
.ag-wf-none { padding: 20px; color: var(--text-mute); text-align: center; }

.ag-wf-actions { flex: 0 0 auto; display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); }
.ag-btn-go { flex: 1; justify-content: center; background: var(--ok); color: #06281c; border-color: transparent; font-weight: 800; }
.ag-btn-stop { flex: 1; justify-content: center; background: var(--danger); color: #2a0d0d; border-color: transparent; font-weight: 800; }

/* Trạng thái tính năng đã thêm vào quy trình (panel giữa) */
.ag-wf-add { width: 20px; height: 20px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); color: var(--text-mute); font-size: 13px; flex: 0 0 auto; }
.ag-wf-add::before { content: "+"; }
.ag-wf-item:hover .ag-wf-add { border-color: var(--accent-border); color: var(--accent); }
.ag-wf-item.added { opacity: .6; }
.ag-wf-item.added .ag-wf-add { border-color: transparent; color: var(--ok); background: rgba(52,211,153,.12); }
.ag-wf-item.added .ag-wf-add::before { content: "✓"; }

/* ---------- Panel Quy trình (pipeline) ---------- */
.ag-pipeline { display: none; flex-direction: column; background: var(--bg); border-left: 1px solid var(--border); min-height: 0; }
.ag-body.has-pipeline .ag-pipeline { display: flex; }
.ag-pl-head { display: flex; align-items: center; justify-content: space-between; padding: 14px; border-bottom: 1px solid var(--border); }
.ag-pl-title { font-size: 13px; font-weight: 800; }
.ag-pl-count { font-size: 12px; font-weight: 600; color: var(--text-mute); }
.ag-pl-body { flex: 1 1 auto; overflow: auto; padding: 12px; min-height: 0; }
.ag-pl-empty { padding: 30px 14px; color: var(--text-mute); text-align: center; font-size: 12.5px; }

.ag-pl-step { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 10px; background: var(--bg-panel); overflow: hidden; }
.ag-pl-step-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--bg-elev); }
.ag-pl-badge { font-size: 11px; font-weight: 700; color: var(--gold); border: 1px solid rgba(232,192,122,.35); padding: 2px 8px; border-radius: 20px; }
.ag-pl-step-name { flex: 1; font-size: 12.5px; font-weight: 600; }
.ag-pl-remove { color: var(--text-mute); cursor: pointer; font-size: 13px; }
.ag-pl-remove:hover { color: var(--danger); }
.ag-pl-step-body { padding: 10px 12px; }
.ag-pl-lbl { font-size: 11px; color: var(--text-dim); margin: 6px 0 4px; }
.ag-pl-select, .ag-pl-input { width: 100%; padding: 8px 10px; background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 12.5px; outline: 0; }
.ag-pl-select:focus, .ag-pl-input:focus { border-color: var(--accent-border); }
.ag-pl-section { font-size: 12px; font-weight: 700; color: var(--gold); margin: 12px 0 6px; padding: 7px 10px; border: 1px solid rgba(232,192,122,.3); border-radius: 8px; background: rgba(232,192,122,.06); }
.ag-pl-radio { display: flex; gap: 18px; padding: 4px 0 2px; }
.ag-pl-radio label { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--text-dim); cursor: pointer; }
.ag-pl-radio input { width: auto; }
.ag-pl-textarea { min-height: 84px; resize: vertical; font-family: inherit; line-height: 1.5; }
.ag-pl-check { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-dim); margin: 8px 0 4px; cursor: pointer; }
.ag-pl-check input { width: auto; }

.ag-pl-foot { flex: 0 0 auto; padding: 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.ag-pl-row { display: flex; gap: 8px; }
.ag-pl-field { flex: 1; display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-dim);
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; }
.ag-pl-field input { flex: 1; width: 100%; background: transparent; border: 0; outline: 0; color: var(--text); font-size: 13px; text-align: right; }
.ag-pl-foot .ag-btn-go { flex: 1; justify-content: center; background: var(--ok); color: #06281c; border-color: transparent; font-weight: 800; }
.ag-pl-foot .ag-btn-stop { flex: 1; justify-content: center; background: var(--danger); color: #2a0d0d; border-color: transparent; font-weight: 800; }
.ag-pl-foot #ag-save-tpl { flex: 1; justify-content: center; }

/* Dấu tính năng đã đấu dây + ô tiến trình bảng */
.ag-wired { color: var(--ok); font-size: 9px; vertical-align: middle; }
.ag-proc { font-weight: 600; font-size: 12px; color: var(--text-dim); }

/* Responsive: thu gọn khi màn hẹp (webapp thiết kế cho màn rộng như SMIT) */
@media (max-width: 1400px) { .ag-body.has-pipeline { grid-template-columns: 54px 1fr 270px 310px; } }
@media (max-width: 1150px) { .ag-body, .ag-body.has-pipeline { grid-template-columns: 54px 1fr 340px; } .ag-body.has-pipeline .ag-pipeline { display: none; } }
@media (max-width: 950px)  { .ag-body, .ag-body.has-pipeline { grid-template-columns: 1fr; } .ag-rail, .ag-workflow, .ag-pipeline { display: none !important; } }
