/* pool.css - giao diện Quản lý Proxy Pool dùng chung (pool.html). Tiền tố .pl-, dùng biến màu của styles.css nên theo giao diện sáng/tối.
 * Cùng phong cách với trang Auto-Replace: header dính 1 hàng, thẻ gọn, bảng có tiêu đề + cột thao tác dính, thẻ mobile. */

.pl-page {
    --pl-bg: var(--bg-secondary, #f8f9fa);
    --pl-surface: var(--bg-card, #fff);
    --pl-surface-2: var(--bg-primary, #f1f3f5);
    --pl-line: var(--border-light, #e9ecef);
    --pl-text: var(--text-primary, #212529);
    --pl-muted: var(--text-secondary, #6c757d);
    --pl-primary: var(--primary-color, #0066cc);
    --pl-primary-soft: rgba(0, 102, 204, .10);
    --pl-ok: #16a34a;
    --pl-bad: #dc2626;
    --pl-warn: #d97706;
    --pl-violet: #7c3aed;
    --pl-cyan: #0891b2;
    background: var(--pl-bg);
    color: var(--pl-text);
    margin: 0; padding: 0;
    min-height: 100vh;
    display: flex; flex-direction: column;
}
.pl-page *, .pl-page *::before, .pl-page *::after { box-sizing: border-box; }
.pl-page [hidden] { display: none !important; }
.pl-page.pl-lock { overflow: hidden; }
.pl-mono { font-family: 'Consolas', 'Monaco', 'Courier New', monospace; font-variant-numeric: tabular-nums; }

/* ---------- Header ---------- */
.pl-header { position: sticky; top: 0; z-index: 900; background: var(--pl-surface); border-bottom: 1px solid var(--pl-line); box-shadow: 0 1px 6px rgba(15, 23, 42, .06); }
.pl-header-in { max-width: 1400px; margin: 0 auto; min-height: 52px; padding: 0 16px; display: flex; align-items: center; gap: 14px; }
.pl-brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 0 0 auto; }
.pl-brand i { font-size: 21px; color: var(--pl-primary); }
.pl-brand h1 { margin: 0; font-size: 17px; font-weight: 700; color: var(--pl-primary); white-space: nowrap; }
.pl-tabs { display: flex; gap: 4px; padding: 3px; border: 1px solid var(--pl-line); border-radius: 10px; background: var(--pl-surface-2); }
.pl-tabs a { padding: 5px 16px; border-radius: 7px; font-size: 13px; font-weight: 700; color: var(--pl-muted); text-decoration: none; white-space: nowrap; }
.pl-tabs a:hover { color: var(--pl-text); }
.pl-tabs a.is-active { background: var(--pl-primary); color: #fff; box-shadow: 0 1px 4px rgba(0, 102, 204, .35); }
.pl-header-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* ---------- Nút ---------- */
.pl-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 14px; border: 1px solid transparent; border-radius: 8px; font: inherit; font-size: 13px; font-weight: 600; line-height: 1; text-decoration: none; white-space: nowrap; cursor: pointer; transition: background-color .12s, border-color .12s, opacity .12s; }
.pl-btn i { font-size: 12px; }
.pl-btn:disabled { opacity: .5; cursor: not-allowed; }
.pl-btn:focus-visible, .pl-icon-btn:focus-visible, .pl-act:focus-visible, .pl-link:focus-visible, .pl-seg button:focus-visible, .pl-page input:focus-visible, .pl-page select:focus-visible, .pl-page textarea:focus-visible, .pl-menu button:focus-visible, th.sortable:focus-visible { outline: 3px solid var(--pl-primary-soft); outline-offset: 2px; }
.pl-btn-sm { height: 30px; padding: 0 11px; font-size: 12.5px; }
.pl-btn-primary { background: var(--pl-primary); color: #fff; }
.pl-btn-primary:hover:not(:disabled) { background: #0052a3; }
.pl-btn-success { background: var(--pl-ok); color: #fff; }
.pl-btn-success:hover:not(:disabled) { background: #15803d; }
.pl-btn-soft { background: var(--pl-surface); color: var(--pl-text); border-color: var(--pl-line); }
.pl-btn-soft:hover:not(:disabled) { border-color: var(--pl-primary); background: var(--pl-primary-soft); }
.pl-btn-ghost { background: var(--pl-surface-2); color: var(--pl-text); border-color: var(--pl-line); }
.pl-btn-ghost:hover { border-color: var(--pl-muted); }
.pl-btn-danger { background: rgba(220, 38, 38, .1); color: var(--pl-bad); border-color: rgba(220, 38, 38, .3); }
.pl-btn-danger:hover:not(:disabled) { background: var(--pl-bad); color: #fff; }
.pl-icon-btn { width: 34px; height: 34px; flex: 0 0 auto; border: 1px solid var(--pl-line); border-radius: 8px; background: var(--pl-surface-2); color: var(--pl-muted); font-size: 13px; cursor: pointer; }
.pl-icon-btn:hover:not(:disabled) { color: var(--pl-primary); border-color: var(--pl-primary); background: var(--pl-primary-soft); }
.pl-icon-btn:disabled { opacity: .4; cursor: not-allowed; }
.pl-link { border: 0; background: none; padding: 0; color: var(--pl-primary); font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; text-decoration: underline; }

/* ---------- Khung + thẻ ---------- */
.pl-main { flex: 1; width: 100%; max-width: 1400px; margin: 0 auto; padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.pl-card { background: var(--pl-surface); border: 1px solid var(--pl-line); border-radius: 14px; padding: 16px 18px 18px; box-shadow: 0 1px 3px rgba(15, 23, 42, .05); }
.pl-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; margin-bottom: 14px; }
.pl-card-head h2 { margin: 0; display: flex; align-items: center; gap: 9px; font-size: 16px; font-weight: 700; }
.pl-card-head h2 > i { width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; background: var(--pl-primary-soft); color: var(--pl-primary); font-size: 13px; }
.pl-count { min-width: 26px; padding: 1px 9px; border-radius: 999px; background: var(--pl-primary-soft); color: var(--pl-primary); font-size: 12px; font-weight: 700; text-align: center; }
.pl-refresh { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--pl-muted); }

/* ---------- Tổng quan ---------- */
.pl-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.pl-stat { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--pl-line); border-left-width: 4px; border-radius: 12px; background: var(--pl-surface); }
.pl-stat-icon { flex: 0 0 auto; width: 38px; height: 38px; display: flex; align-items: center; justify-content: center; border-radius: 11px; font-size: 16px; }
.pl-stat-num { font-size: 24px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.pl-stat-label { margin-top: 2px; font-size: 12px; font-weight: 600; color: var(--pl-muted); }
.pl-stat-total { border-left-color: #6366f1; } .pl-stat-total .pl-stat-icon { background: rgba(99, 102, 241, .12); color: #6366f1; }
.pl-stat-live { border-left-color: var(--pl-ok); } .pl-stat-live .pl-stat-icon { background: rgba(22, 163, 74, .12); color: var(--pl-ok); } .pl-stat-live .pl-stat-num { color: var(--pl-ok); }
.pl-stat-dead { border-left-color: var(--pl-bad); } .pl-stat-dead .pl-stat-icon { background: rgba(220, 38, 38, .1); color: var(--pl-bad); } .pl-stat-dead .pl-stat-num { color: var(--pl-bad); }
.pl-stat-rate { border-left-color: var(--pl-primary); } .pl-stat-rate .pl-stat-icon { background: var(--pl-primary-soft); color: var(--pl-primary); }

.pl-dispatch { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(0, 3fr); gap: 12px; margin-top: 12px; }
.pl-dispatch-item { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 14px; border: 1px solid var(--pl-line); border-radius: 12px; background: var(--pl-surface-2); min-width: 0; }
.pl-dispatch-label { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--pl-muted); white-space: nowrap; }
.pl-dispatch-label i { color: var(--pl-violet); margin-right: 5px; }
.pl-dispatch-val { font-size: 13.5px; color: var(--pl-muted); white-space: nowrap; }
.pl-dispatch-val b { color: var(--pl-text); font-size: 15px; font-variant-numeric: tabular-nums; }
.pl-dispatch-item:first-child .pl-dispatch-val { margin-left: auto; font-size: 22px; font-weight: 800; color: var(--pl-violet); }
.pl-dispatch-wide { flex-wrap: nowrap; }
.pl-dispatch-bar { flex: 1; min-width: 60px; height: 8px; border-radius: 999px; background: var(--pl-line); overflow: hidden; }
.pl-dispatch-bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--pl-violet), var(--pl-cyan)); transition: width .5s ease; }

.pl-health { display: flex; align-items: center; gap: 8px; margin: -4px 0 12px; padding: 7px 12px; border: 1px solid var(--pl-line); border-radius: 10px; background: var(--pl-surface-2); font-size: 12.5px; color: var(--pl-muted); line-height: 1.4; }
.pl-health i { color: var(--pl-ok); }

/* ---------- Thanh công cụ ---------- */
.pl-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 14px; margin-bottom: 12px; }
.pl-toolbar-main, .pl-toolbar-filter { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.pl-search { position: relative; width: 260px; }
.pl-search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 13px; color: var(--pl-muted); pointer-events: none; }
.pl-search input { width: 100%; height: 34px; padding: 0 12px 0 34px; border: 1.5px solid var(--pl-line); border-radius: 8px; background: var(--pl-surface); color: var(--pl-text); font: inherit; font-size: 13.5px; }
.pl-search input:focus { outline: none; border-color: var(--pl-primary); box-shadow: 0 0 0 3px var(--pl-primary-soft); }
.pl-seg { display: inline-flex; padding: 3px; gap: 3px; border: 1px solid var(--pl-line); border-radius: 10px; background: var(--pl-surface-2); }
.pl-seg button { height: 28px; padding: 0 13px; border: 0; border-radius: 7px; background: transparent; color: var(--pl-muted); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.pl-seg button.is-active { background: var(--pl-primary); color: #fff; }

.pl-menu-wrap { position: relative; }
.pl-menu { position: absolute; z-index: 50; top: calc(100% + 6px); left: 0; min-width: 240px; padding: 6px; border: 1px solid var(--pl-line); border-radius: 12px; background: var(--pl-surface); box-shadow: 0 14px 34px rgba(15, 23, 42, .22); }
.pl-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border: 0; border-radius: 8px; background: transparent; color: var(--pl-text); font: inherit; font-size: 13.5px; font-weight: 600; text-align: left; cursor: pointer; }
.pl-menu button i { width: 16px; text-align: center; color: var(--pl-muted); }
.pl-menu button:hover { background: var(--pl-primary-soft); }
.pl-menu button.is-danger { color: var(--pl-bad); } .pl-menu button.is-danger i { color: var(--pl-bad); } .pl-menu button.is-danger:hover { background: rgba(220, 38, 38, .1); }
.pl-menu-title { padding: 6px 12px 2px; font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--pl-muted); }
.pl-menu-danger-title { color: var(--pl-bad); }
.pl-menu-sep { height: 1px; margin: 5px 4px; background: var(--pl-line); }

.pl-selbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 14px; margin-bottom: 12px; padding: 9px 14px; border: 1px solid rgba(0, 102, 204, .3); border-radius: 10px; background: var(--pl-primary-soft); font-size: 13px; font-weight: 600; }
.pl-selbar i { color: var(--pl-primary); margin-right: 6px; }
.pl-selbar-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }

/* ---------- Bảng ---------- */
.pl-table-wrap { border: 1px solid var(--pl-line); border-radius: 12px; overflow: auto; max-height: calc(100vh - 250px); min-height: 260px; overscroll-behavior: contain; scrollbar-width: thin; }
.pl-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; min-width: 900px; }
.pl-table th { position: sticky; top: 0; z-index: 3; padding: 10px 12px; text-align: center; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--pl-muted); background: var(--pl-surface-2); border-bottom: 2px solid var(--pl-primary); white-space: nowrap; user-select: none; }
.pl-table th.c-proxy { text-align: left; }
.pl-table th.sortable { cursor: pointer; }
.pl-table th.sortable:hover { color: var(--pl-text); }
.pl-table th.sortable::after { content: ''; display: inline-block; margin-left: 6px; border: 4px solid transparent; opacity: 0; }
.pl-table th.is-sorted { color: var(--pl-primary); }
.pl-table th.is-sorted[data-dir="asc"]::after { border-bottom-color: currentColor; border-top-width: 0; opacity: 1; }
.pl-table th.is-sorted[data-dir="desc"]::after { border-top-color: currentColor; border-bottom-width: 0; opacity: 1; }
.pl-table td { padding: 8px 12px; border-bottom: 1px solid var(--pl-line); text-align: center; vertical-align: middle; background: var(--pl-surface); transition: background-color .3s; }
.pl-table tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--pl-surface) 96%, var(--pl-muted)); }
.pl-table tbody tr:hover td { background: var(--pl-primary-soft); }
.pl-table tbody tr:last-child td { border-bottom: 0; }
.pl-table tr.is-sel td { background: rgba(0, 102, 204, .12); }
.pl-table tr.flash-ok td { background: rgba(22, 163, 74, .22); }
.pl-table tr.flash-bad td { background: rgba(220, 38, 38, .2); }
.pl-table .c-check { width: 40px; padding: 8px 6px; }
.pl-table .c-status { width: 96px; } .pl-table .c-ping { width: 92px; } .pl-table .c-fail { width: 64px; } .pl-table .c-disp { width: 82px; } .pl-table .c-round { width: 66px; } .pl-table .c-last { width: 130px; white-space: nowrap; color: var(--pl-muted); font-size: 12px; } .pl-table .c-act { width: 92px; }
.pl-table td.c-proxy { text-align: left; }
.pl-table td.c-fail.is-bad { color: var(--pl-bad); font-weight: 700; }
.pl-table td.c-disp.is-on, .pl-table td.c-round.is-on { color: var(--pl-violet); font-weight: 700; }
.pl-cb, #selectAll { width: 16px; height: 16px; accent-color: var(--pl-primary); cursor: pointer; margin: 0; }
/* cột thao tác dính mép phải: không bao giờ bị che khi cuộn ngang */
.pl-table th.c-act, .pl-table td.c-act { position: sticky; right: 0; box-shadow: -8px 0 8px -8px rgba(15, 23, 42, .22); }
.pl-table th.c-act { z-index: 5; }
.pl-table td.c-act { z-index: 2; }

.pl-proxy { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pl-proxy-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: 'Consolas', 'Monaco', 'Courier New', monospace; font-size: 12.5px; }
.pl-type { flex: 0 0 auto; padding: 2px 7px; border-radius: 5px; font-size: 10.5px; font-weight: 700; letter-spacing: .03em; color: #fff; }
.pl-type-socks5 { background: #6366f1; } .pl-type-http { background: #10b981; }
.pl-badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.pl-badge i { font-size: 7px; }
.pl-badge.is-live { color: var(--pl-ok); background: rgba(22, 163, 74, .12); }
.pl-badge.is-dead { color: var(--pl-bad); background: rgba(220, 38, 38, .1); }
.pl-ping { font-weight: 700; font-variant-numeric: tabular-nums; }
.pl-ping.is-good { color: var(--pl-ok); } .pl-ping.is-mid { color: var(--pl-warn); } .pl-ping.is-bad { color: var(--pl-bad); } .pl-ping.is-muted { color: var(--pl-muted); font-weight: 500; }
.pl-acts { display: flex; justify-content: center; gap: 4px; }
.pl-act { width: 28px; height: 28px; padding: 0; flex: 0 0 auto; border: 1px solid var(--pl-line); border-radius: 7px; background: var(--pl-surface); color: var(--pl-primary); font-size: 12px; cursor: pointer; }
.pl-act:hover:not(:disabled) { background: var(--pl-primary-soft); border-color: var(--pl-primary); }
.pl-act-danger { color: var(--pl-bad); } .pl-act-danger:hover:not(:disabled) { background: rgba(220, 38, 38, .1); border-color: var(--pl-bad); }
.pl-act-quiet { border-color: transparent; background: transparent; color: var(--pl-muted); }
.pl-empty { padding: 34px 14px; text-align: center; color: var(--pl-muted); font-size: 13.5px; }
.pl-empty.is-error { color: var(--pl-bad); }
.pl-empty i { margin-right: 6px; }

/* thẻ mobile */
.pl-cards { display: none; }
.pl-pcard { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--pl-line); }
.pl-pcard.is-sel { background: rgba(0, 102, 204, .1); }
.pl-pcard.is-dead { box-shadow: inset 3px 0 0 var(--pl-bad); }
.pl-pcard-top { display: flex; align-items: center; gap: 8px; }
.pl-pcard-top .pl-badge { margin-left: auto; }
.pl-pcard-proxy { font-size: 12.5px; overflow-wrap: anywhere; line-height: 1.45; }
.pl-pcard-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 10px; }
.pl-pcard-cell { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.pl-pcard-cell:last-child { grid-column: span 2; }
.pl-pcard-label { font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--pl-muted); }
.pl-pcard-cell b { font-size: 13px; }
.pl-pcard-cell b.is-bad { color: var(--pl-bad); }
.pl-pcard-foot { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.pl-pcard-foot .pl-btn { height: 38px; }

/* phân trang */
.pl-pager { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 14px; margin-top: 12px; font-size: 12.5px; color: var(--pl-muted); }
.pl-pager-ctl { display: flex; align-items: center; gap: 8px; }
.pl-per { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 12.5px; }
.pl-per select { height: 32px; padding: 0 8px; border: 1.5px solid var(--pl-line); border-radius: 8px; background: var(--pl-surface); color: var(--pl-text); font: inherit; font-weight: 600; }
.pl-pager-page { min-width: 60px; text-align: center; font-weight: 700; color: var(--pl-text); }

/* ---------- Modal ---------- */
.pl-modal { position: fixed; inset: 0; z-index: 2500; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(15, 23, 42, .55); backdrop-filter: blur(3px); }
.pl-modal-box { width: min(480px, 100%); max-height: min(760px, calc(100vh - 32px)); max-height: min(760px, calc(100dvh - 32px)); display: flex; flex-direction: column; border-radius: 16px; background: var(--pl-surface); color: var(--pl-text); box-shadow: 0 24px 60px rgba(0, 0, 0, .4); overflow: hidden; }
.pl-modal-lg { width: min(720px, 100%); }
.pl-modal-head { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--pl-line); background: linear-gradient(135deg, var(--pl-primary-soft), transparent 70%); }
.pl-modal-head h3 { margin: 0; display: flex; align-items: center; gap: 9px; font-size: 16.5px; font-weight: 700; }
.pl-modal-head h3 > i { color: var(--pl-primary); }
.pl-modal-body { flex: 1 1 auto; min-height: 0; padding: 16px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.pl-modal-foot { flex: 0 0 auto; display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--pl-line); }
.pl-label { display: block; margin: 0 0 6px; font-size: 13px; font-weight: 700; }
.pl-label small { font-weight: 500; color: var(--pl-muted); }
.pl-label code, .pl-note code { padding: 1px 6px; border-radius: 5px; background: var(--pl-surface-2); border: 1px solid var(--pl-line); font-family: 'Consolas', monospace; font-size: 12px; color: var(--pl-primary); }
#addText { width: 100%; min-height: 190px; padding: 12px 14px; border: 1.5px solid var(--pl-line); border-radius: 10px; background: var(--pl-surface-2); color: var(--pl-text); font-family: 'Consolas', 'Monaco', monospace; font-size: 13px; line-height: 1.6; white-space: pre; overflow: auto; resize: vertical; }
#addText:focus { outline: none; border-color: var(--pl-primary); box-shadow: 0 0 0 3px var(--pl-primary-soft); background: var(--pl-surface); }
.pl-add-stats { display: flex; flex-wrap: wrap; gap: 6px; }
.pl-chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pl-chip-muted { color: var(--pl-muted); background: var(--pl-surface-2); border: 1px solid var(--pl-line); }
.pl-chip-ok { color: var(--pl-ok); background: rgba(22, 163, 74, .1); }
.pl-chip-bad { color: var(--pl-bad); background: rgba(220, 38, 38, .1); }
.pl-chip-warn { color: var(--pl-warn); background: rgba(217, 119, 6, .12); }
.pl-problems { padding: 8px 10px; border: 1px solid rgba(220, 38, 38, .2); border-radius: 8px; background: rgba(220, 38, 38, .06); color: var(--pl-bad); font-size: 12px; line-height: 1.5; max-height: 100px; overflow: auto; }
.pl-field-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pl-note { padding: 10px 12px; border-radius: 10px; background: var(--pl-primary-soft); border: 1px solid rgba(0, 102, 204, .25); font-size: 13px; }
.pl-note i { color: var(--pl-primary); margin-right: 6px; }
.pl-dup-list { display: flex; flex-direction: column; gap: 10px; }
.pl-dup-group { padding: 10px 12px; border: 1px solid var(--pl-line); border-left: 4px solid var(--pl-warn); border-radius: 10px; background: var(--pl-surface-2); }
.pl-dup-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; font-weight: 700; }
.pl-dup-head i { color: var(--pl-warn); }
.pl-dup-group ul { margin: 6px 0 0; padding-left: 22px; font-size: 12.5px; color: var(--pl-muted); }
.pl-progress { height: 10px; border-radius: 999px; background: var(--pl-line); overflow: hidden; }
.pl-progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--pl-primary), #0a84ff); transition: width .2s; }
.pl-check-text { font-size: 13.5px; font-weight: 600; text-align: center; }
.pl-check-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pl-check-stats > div { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 6px; border: 1px solid var(--pl-line); border-radius: 10px; font-size: 12px; color: var(--pl-muted); }
.pl-check-stats b { font-size: 22px; color: var(--pl-text); font-variant-numeric: tabular-nums; }
.pl-check-stats .live i { color: var(--pl-ok); } .pl-check-stats .dead i { color: var(--pl-bad); } .pl-check-stats .total i { color: var(--pl-primary); }
.pl-timer { padding: 3px 10px; border-radius: 999px; background: var(--pl-surface-2); border: 1px solid var(--pl-line); font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- Toast, loading, footer ---------- */
.pl-toasts { position: fixed; bottom: 16px; right: 16px; z-index: 3200; display: flex; flex-direction: column; gap: 8px; pointer-events: none; max-width: min(420px, calc(100vw - 32px)); }
.pl-toast { display: flex; align-items: flex-start; gap: 10px; padding: 11px 14px; border-radius: 10px; background: var(--pl-surface); border: 1px solid var(--pl-line); border-left: 4px solid var(--pl-primary); box-shadow: 0 8px 24px rgba(15, 23, 42, .18); font-size: 13.5px; font-weight: 600; animation: pl-in .2s ease-out; pointer-events: none; }
.pl-toast i { margin-top: 2px; }
.pl-toast-success { border-left-color: var(--pl-ok); } .pl-toast-success i { color: var(--pl-ok); }
.pl-toast-error { border-left-color: var(--pl-bad); } .pl-toast-error i { color: var(--pl-bad); }
.pl-toast-info i { color: var(--pl-primary); }
.pl-toast.is-out { opacity: 0; transform: translateX(12px); transition: opacity .3s, transform .3s; }
@keyframes pl-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.pl-loading { position: fixed; inset: 0; z-index: 3100; display: none; align-items: center; justify-content: center; background: rgba(15, 23, 42, .5); backdrop-filter: blur(2px); }
.pl-loading.show { display: flex; }
.pl-loading-box { padding: 22px 30px; border-radius: 14px; background: var(--pl-surface); text-align: center; box-shadow: 0 16px 40px rgba(0, 0, 0, .3); }
.pl-loading-box i { font-size: 26px; color: var(--pl-primary); }
.pl-loading-box p { margin: 10px 0 0; font-weight: 600; }
.pl-footer { padding: 14px 16px 22px; text-align: center; font-size: 12.5px; color: var(--pl-muted); }
.pl-footer p { margin: 0; }

/* ---------- Tablet ---------- */
@media (max-width: 1100px) {
    .pl-search { width: 210px; }
}
@media (max-width: 900px) {
    .pl-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pl-dispatch { grid-template-columns: 1fr; }
}

/* ---------- Mobile ---------- */
@media (max-width: 768px) {
    .pl-dispatch-wide { flex-wrap: wrap; }
    .pl-dispatch-bar { flex: 1 1 100%; order: 3; }
    .pl-dispatch-val { white-space: normal; }
    .pl-header-in { flex-wrap: wrap; padding: 6px 12px; gap: 6px 10px; }
    .pl-brand h1 { font-size: 15px; }
    .pl-tabs { order: 3; width: 100%; }
    .pl-tabs a { flex: 1; text-align: center; padding: 7px 0; }
    .pl-header-actions { margin-left: auto; }
    .pl-btn-ghost span, .pl-btn-danger:not(.pl-btn-sm) span { }
    .pl-header-actions .pl-btn span { display: none; }
    .pl-header-actions .pl-btn { width: 38px; padding: 0; }
    .pl-main { padding: 12px 10px; gap: 12px; }
    .pl-card { padding: 14px 12px; border-radius: 12px; }
    .pl-stat { padding: 9px 10px; gap: 9px; }
    .pl-stat-icon { width: 34px; height: 34px; font-size: 15px; }
    .pl-stat-num { font-size: 20px; }
    .pl-toolbar { flex-direction: column; align-items: stretch; }
    .pl-toolbar-main { display: grid; grid-template-columns: 1fr 1fr; }
    .pl-toolbar-main .pl-menu-wrap { grid-column: 1 / -1; }
    .pl-toolbar-main .pl-btn, .pl-menu-wrap .pl-btn { width: 100%; height: 40px; }
    .pl-menu { left: 0; right: 0; min-width: 0; }
    .pl-toolbar-filter { flex-direction: column; align-items: stretch; }
    .pl-search { width: 100%; }
    .pl-search input { height: 42px; font-size: 16px; }   /* >=16px: Chrome Android không tự phóng to */
    .pl-seg { width: 100%; } .pl-seg button { flex: 1; height: 34px; }
    .pl-table { display: none; }
    .pl-cards { display: block; }
    .pl-table-wrap { max-height: none; min-height: 0; }
    .pl-pager { justify-content: center; }
    .pl-selbar { flex-direction: column; align-items: stretch; }
    .pl-selbar-actions .pl-btn { flex: 1; height: 38px; }
    .pl-modal { align-items: flex-end; padding: 0; }
    .pl-modal-box, .pl-modal-lg { width: 100%; border-radius: 16px 16px 0 0; max-height: 92vh; max-height: 92dvh; }
    #addText { font-size: 16px; }
    .pl-modal-foot { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
    .pl-modal-foot .pl-btn { flex: 1; height: 44px; }
    .pl-toasts { left: 10px; right: 10px; bottom: 10px; max-width: none; }
    .pl-refresh span { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
    .pl-page * { transition: none !important; animation: none !important; }
}
