/* ============================================================================
 *  DATA TOOLS  (assets/css/data-tools.css)
 *  Shared by restore-records.php, manage-duplicates.php, target-accounts.php
 *  and data-cleanup.php (the object ⋮ menu tools). CRM button style: 42px,
 *  8px corners, brand fill - no pill buttons. Responsive down to 360px.
 * ========================================================================== */
.dt { max-width: 1240px; margin: 0 auto; padding: 24px 28px 64px; color: var(--text); }
.dt *, .dt *::before, .dt *::after { box-sizing: border-box; }
.dt-sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.dt-back { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 14px; font-size: 14px; font-weight: 600; color: var(--brand); text-decoration: none; }
.dt-back:hover { text-decoration: underline; }
.dt-back svg { width: 16px; height: 16px; }
.dt-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.dt-h1 { margin: 0; font-size: 26px; line-height: 1.25; font-weight: 700; letter-spacing: -.01em; }
.dt-h2 { margin: 0; font-size: 20px; line-height: 1.3; font-weight: 700; }
.dt-h3 { margin: 0 0 8px; font-size: 16px; font-weight: 700; }
.dt-sub { margin: 6px 0 0; font-size: 14.5px; color: var(--text-muted); }
.dt-p { margin: 0 0 12px; font-size: 14.5px; line-height: 1.55; color: var(--text-muted); }
.dt-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.dt-muted { color: var(--text-muted); }
.dt-small { font-size: 13px; color: var(--text-muted); }

/* ---------------------------------------------------------------- buttons */
.dt-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px; font: inherit; font-size: 14.5px; font-weight: 600; line-height: 1; white-space: nowrap;
  color: var(--text); background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); cursor: pointer; text-decoration: none;
  transition: background-color .15s, border-color .15s, color .15s;
}
.dt-btn:hover { background: var(--surface-hover); }
.dt-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.dt-btn[disabled], .dt-btn.is-disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.dt-btn--primary { color: #fff; background: var(--brand); border-color: var(--brand); }
.dt-btn--primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.dt-btn--danger { color: #fff; background: #d92d20; border-color: #d92d20; }
.dt-btn--danger:hover { background: #b42318; border-color: #b42318; }
.dt-btn--sm { height: 34px; padding: 0 14px; font-size: 13.5px; }
.dt-btn--xs { height: 30px; padding: 0 10px; font-size: 13px; }
.dt-btn--link { height: auto; padding: 2px 0; color: var(--brand); background: none; border: 0; }
.dt-btn--link:hover { background: none; text-decoration: underline; }
.dt-btn svg { width: 16px; height: 16px; flex: none; }
.dt-x { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; color: var(--text-muted); background: none; border: 0; border-radius: var(--radius-sm); cursor: pointer; flex: none; }
.dt-x:hover { background: var(--surface-hover); color: var(--text); }
.dt-x svg { width: 18px; height: 18px; }
.dt-x:focus-visible { outline: 2px solid var(--brand); }

/* ------------------------------------------------------------------ forms */
.dt-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; font-size: 14px; font-weight: 600; }
.dt-field > span small { font-weight: 400; color: var(--text-muted); }
.dt-req { color: #d92d20; }
.dt-input, .dt-select {
  width: 100%; height: 40px; padding: 0 12px; font: inherit; font-size: 14px; font-weight: 400; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
}
.dt-select { appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23475467' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; }
.dt-input:focus, .dt-select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(36, 86, 230, .15); }
.dt-input[aria-invalid="true"] { border-color: #d92d20; }
.dt-err { margin: -8px 0 12px; font-size: 13px; color: #d92d20; }
.dt-search { position: relative; display: inline-flex; min-width: 0; }
.dt-search input { width: 260px; max-width: 100%; height: 40px; padding: 0 36px 0 12px; font: inherit; font-size: 14px; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); }
.dt-search input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(36, 86, 230, .15); }
.dt-search svg { position: absolute; right: 11px; top: 50%; width: 16px; height: 16px; margin-top: -8px; color: var(--text-muted); pointer-events: none; }
.dt-check { display: inline-flex; position: relative; width: 18px; height: 18px; flex: none; }
.dt-check input { position: absolute; inset: 0; margin: 0; width: 18px; height: 18px; cursor: pointer; accent-color: var(--brand); }

/* ------------------------------------------------------------------- tabs */
.dt-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.dt-tabs::-webkit-scrollbar { display: none; }
.dt-tab { position: relative; padding: 12px 16px; font: inherit; font-size: 14.5px; font-weight: 600; color: var(--text-muted); background: none; border: 0; cursor: pointer; white-space: nowrap; text-decoration: none; }
.dt-tab:hover { color: var(--text); }
.dt-tab[aria-selected="true"], .dt-tab.is-active { color: var(--text); }
.dt-tab[aria-selected="true"]::after, .dt-tab.is-active::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 3px; background: var(--text); border-radius: 2px 2px 0 0; }
.dt-tab:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.dt-count { font-weight: 400; color: var(--text-muted); }

/* -------------------------------------------------------- cards / banners */
.dt-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.dt-card__pad { padding: 20px 24px; }
.dt-banner { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; margin-bottom: 16px; font-size: 14px; line-height: 1.5; color: #0b4a6f; background: #eaf6fd; border: 1px solid #7cc4ef; border-radius: var(--radius-sm); }
.dt-banner strong { display: block; margin-bottom: 2px; font-size: 15px; color: #0b3550; }
.dt-banner > div { flex: 1; min-width: 0; }
.dt-banner .dt-x { width: 30px; height: 30px; color: #0b4a6f; }
.dt-banner--ok { color: #05603a; background: #ecfdf3; border-color: #6ce9a6; }
.dt-banner--ok strong { color: #054f31; }
.dt-badge { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; font-size: 12.5px; font-weight: 600; border-radius: 6px; background: var(--surface-3); color: var(--text-muted); white-space: nowrap; }
.dt-badge--green { background: #dcfae6; color: #067647; }
.dt-badge--blue { background: #e0eaff; color: #2456e6; }
.dt-badge--amber { background: #fef0c7; color: #93370d; }
.dt-dot { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-muted); white-space: nowrap; }
.dt-dot::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--text-subtle); flex: none; }
.dt-dot--on::before { background: #12b76a; }
.dt-dot--on { color: var(--text); }
.dt-empty { padding: 48px 16px; text-align: center; color: var(--text-muted); font-size: 14.5px; }
.dt-empty svg { display: block; width: 120px; height: 96px; margin: 0 auto 14px; }
.dt-empty strong { display: block; margin-bottom: 4px; font-size: 16px; color: var(--text); }

/* ------------------------------------------------------------------ table */
.dt-tablewrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.dt-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.dt-table th { position: sticky; top: 0; padding: 12px 14px; font-size: 13px; font-weight: 700; text-align: left; text-transform: none; color: var(--text); background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.dt-table td { padding: 12px 14px; vertical-align: middle; border-bottom: 1px solid var(--border); text-transform: none; }
.dt-table tbody tr:hover td { background: var(--surface-2); }
.dt-table tbody tr.is-sel td { background: var(--brand-soft); color: var(--text); }
.dt-table .dt-colcheck { width: 44px; padding-right: 0; }
.dt-name { font-weight: 600; color: var(--brand); text-decoration: none; }
a.dt-name:hover { text-decoration: underline; }
span.dt-name { color: var(--text); }
.dt-line2 { display: block; margin-top: 2px; font-size: 13px; color: var(--text-muted); }
.dt-thbtn { display: inline-flex; align-items: center; gap: 4px; padding: 0; font: inherit; font-weight: 700; color: inherit; background: none; border: 0; cursor: pointer; }
.dt-thbtn svg { width: 14px; height: 14px; color: var(--text-muted); }

.dt-pager { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px; padding: 16px 8px; font-size: 14px; }
.dt-pager button { min-width: 34px; height: 34px; padding: 0 10px; font: inherit; font-size: 14px; font-weight: 600; color: var(--text); background: var(--surface); border: 1px solid transparent; border-radius: var(--radius-sm); cursor: pointer; }
.dt-pager button:hover:not([disabled]) { background: var(--surface-hover); }
.dt-pager button[aria-current="page"] { border-color: var(--text); }
.dt-pager button[disabled] { color: var(--text-subtle); cursor: default; }
.dt-pager .dt-select { width: auto; height: 34px; margin-left: 10px; }

/* ----------------------------------------------------------- menus / pops */
.dt-pop { position: fixed; z-index: 1500; min-width: 200px; max-width: calc(100vw - 16px); max-height: min(420px, calc(100vh - 24px)); overflow-y: auto; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: 0 12px 32px rgba(16, 24, 40, .16); }
.dt-pop__head { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 8px; font-weight: 700; font-size: 14px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.dt-menu__item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; font: inherit; font-size: 14px; text-align: left; color: var(--text); background: none; border: 0; border-radius: 6px; cursor: pointer; text-decoration: none; }
.dt-menu__item:hover, .dt-menu__item:focus-visible { background: var(--surface-hover); outline: none; }
.dt-menu__item[aria-checked="true"]::after { content: "✓"; margin-left: auto; color: var(--brand); font-weight: 700; }
.dt-menu__item[disabled] { color: var(--text-subtle); cursor: default; }
.dt-menu__sep { height: 1px; margin: 4px 2px; background: var(--border); }
.dt-pop .dt-search { display: flex; margin: 2px 2px 6px; }
.dt-pop .dt-search input { width: 100%; height: 36px; }

/* ----------------------------------------------------------------- modal */
.dt-modal-ov { position: fixed; inset: 0; z-index: 1400; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(16, 24, 40, .5); }
.dt-modal { display: flex; flex-direction: column; width: 560px; max-width: 100%; max-height: calc(100vh - 32px); background: #fff; color: #101828; border-radius: var(--radius-lg); box-shadow: 0 24px 48px rgba(16, 24, 40, .24); overflow: hidden; }
.dt-modal--lg { width: 1080px; }
.dt-modal--md { width: 720px; }
.dt-modal__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 24px; border-bottom: 1px solid #e4e7ec; background: #fff; }
.dt-modal__head h2 { margin: 0; font-size: 19px; font-weight: 700; color: #101828; }
.dt-modal__body { flex: 1; overflow-y: auto; padding: 20px 24px; font-size: 14.5px; line-height: 1.5; }
.dt-modal__foot { display: flex; flex-wrap: wrap; gap: 10px; padding: 16px 24px; border-top: 1px solid #e4e7ec; background: #fff; }
.dt-modal__foot--end { justify-content: flex-end; }
body.dt-noscroll { overflow: hidden; }

/* ============================================================ RESTORE RECORDS */
.rr-filters { display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; margin-bottom: 16px; }
.rr-range__lbl { font-size: 14px; font-weight: 600; }
.rr-date { position: relative; display: inline-flex; }
.rr-date svg { position: absolute; left: 11px; top: 50%; width: 16px; height: 16px; margin-top: -8px; color: var(--text-muted); pointer-events: none; }
.rr-date .dt-input { padding-left: 34px; }
.rr-filters .dt-field { margin: 0; }
.rr-range { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rr-range .dt-input { width: 150px; }
.rr-range__to { font-size: 14px; color: var(--text-muted); }
.rr-user { width: 200px; }
.rr-user[disabled] { opacity: .6; cursor: not-allowed; }
.rr-box .dt-toolbar { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.rr-by { display: block; font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.rr-av { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; margin: 0 4px 0 2px; font-size: 10px; font-weight: 700; color: #fff; background: #7a5af8; border-radius: 50%; vertical-align: -5px; }
.rr-rowact { visibility: hidden; }
.dt-table tbody tr:hover .rr-rowact, .dt-table tbody tr:focus-within .rr-rowact { visibility: visible; }
.rr-namecell { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.rr-name { font-weight: 600; }
.rr-selbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 16px; font-size: 14px; background: var(--brand-soft); color: var(--text); border-bottom: 1px solid var(--border); }

/* ========================================================= MANAGE DUPLICATES */
.md-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; padding: 20px 24px 8px; }
.md-rules { display: flex; flex-direction: column; gap: 12px; }
.md-rule { display: block; width: 100%; padding: 10px 14px; font: inherit; font-size: 14px; text-align: left; color: var(--text); background: var(--surface-3); border: 0; border-left: 3px solid var(--text); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.md-check { margin: 0 0 14px; font-size: 14px; color: var(--text); }
.md-tools { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.md-box { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.md-pair td { border-bottom: 0; padding-top: 8px; padding-bottom: 8px; }
.md-pair--b td { border-bottom: 1px solid var(--border); }
.md-rec { display: flex; align-items: center; gap: 10px; min-width: 0; }
.md-av { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; flex: none; font-size: 12px; font-weight: 700; color: var(--text-muted); background: var(--surface-3); border-radius: 50%; }
.md-rec__txt { min-width: 0; }
.md-rec__txt .dt-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; }
.md-sim { text-align: center; }
.md-acts { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.md-selbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 14px; background: var(--brand-soft); color: var(--text); border-bottom: 1px solid var(--border); font-size: 14px; }
/* merge dialog */
.mm-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) 32px minmax(0, 1fr); gap: 16px; padding: 20px; background: var(--surface-3); border-radius: var(--radius-sm); }
.mm-label { display: flex; align-items: center; gap: 6px; margin: 0 0 10px; font-size: 14px; font-weight: 700; }
.mm-prim { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.mm-card { display: block; position: relative; padding: 14px 14px 14px 44px; background: #fff; border: 1px solid #d0d5dd; border-radius: var(--radius-sm); cursor: pointer; font-size: 13.5px; min-width: 0; }
.mm-card input { position: absolute; left: 14px; top: 16px; width: 18px; height: 18px; margin: 0; accent-color: var(--text); }
.mm-card.is-on { border-color: var(--text); box-shadow: 0 0 0 1px var(--text); }
.mm-card strong { display: block; font-size: 15px; overflow-wrap: anywhere; }
.mm-card .dt-line2 { overflow-wrap: anywhere; }
.mm-card dl { margin: 8px 0 0; }
.mm-card dt { font-size: 12.5px; color: var(--text-muted); }
.mm-card dd { margin: 0; }
.mm-props { display: flex; flex-direction: column; gap: 8px; }
.mm-row { display: grid; grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1fr); align-items: center; gap: 4px; }
.mm-opt { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; background: #fff; border: 1px solid #d0d5dd; border-radius: var(--radius-sm); cursor: pointer; font-size: 13px; min-width: 0; }
.mm-opt input { margin: 2px 0 0; width: 16px; height: 16px; flex: none; accent-color: var(--text); }
.mm-opt span { min-width: 0; overflow-wrap: anywhere; }
.mm-opt small { display: block; font-size: 12px; color: var(--text-muted); }
.mm-opt.is-on { border-color: var(--text); background: #f9fafb; }
.mm-opt.is-off { opacity: .55; cursor: default; }
.mm-swap { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; margin: 0 auto; color: var(--text-muted); background: #fff; border: 1px solid #d0d5dd; border-radius: 50%; cursor: pointer; padding: 0; }
.mm-swap svg { width: 12px; height: 12px; }
.mm-swap:hover { color: var(--text); border-color: var(--text); }
.mm-arrow { display: flex; align-items: center; justify-content: center; color: var(--text-muted); }
.mm-arrow svg { width: 28px; height: 28px; }
.mm-preview { align-self: start; padding: 18px; background: #fff; border: 1px solid #d0d5dd; border-radius: var(--radius-lg); font-size: 13.5px; min-width: 0; }
.mm-preview h3 { margin: 0; font-size: 20px; overflow-wrap: anywhere; }
.mm-preview h4 { margin: 18px 0 8px; font-size: 15px; }
.mm-preview dl { margin: 0; display: grid; gap: 10px; }
.mm-preview dt { font-size: 12.5px; color: var(--text-muted); }
.mm-preview dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.mm-more { margin-top: 14px; }
.mm-more summary { cursor: pointer; font-weight: 700; font-size: 15px; list-style: none; display: flex; align-items: center; gap: 8px; }
.mm-more summary::-webkit-details-marker { display: none; }
.mm-more summary::before { content: "›"; font-size: 20px; line-height: 1; transition: transform .15s; }
.mm-more[open] summary::before { transform: rotate(90deg); }
.mm-more p { margin: 10px 0 6px; font-weight: 600; }
.mm-more ul { margin: 0; padding-left: 20px; list-style: disc; }
.mm-more li { margin: 4px 0; }
.mm-pos { margin-left: auto; font-size: 13px; color: var(--text-muted); align-self: center; }

/* =========================================================== TARGET ACCOUNTS */
.ta-views { display: flex; align-items: stretch; flex-wrap: wrap; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.ta-view { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 0 16px; height: 42px; font: inherit; font-size: 14px; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-bottom: 0; margin-right: -1px; cursor: pointer; white-space: nowrap; }
.ta-view[aria-selected="true"] { background: var(--surface); font-weight: 600; box-shadow: inset 0 3px 0 var(--brand); }
.ta-view:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.ta-filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.ta-fbtn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; font: inherit; font-size: 14px; font-weight: 600; color: var(--text); background: none; border: 1px solid transparent; border-radius: var(--radius-sm); cursor: pointer; }
.ta-fbtn:hover, .ta-fbtn[aria-expanded="true"] { background: var(--surface-hover); }
.ta-fbtn.is-on { color: var(--brand); border-color: var(--brand); background: var(--brand-soft); }
.ta-fbtn svg { width: 14px; height: 14px; }
.ta-metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin-bottom: 16px; padding: 18px 8px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.ta-metric { display: flex; flex-direction: column; justify-content: space-between; padding: 0 12px; text-align: center; border-left: 1px solid var(--border); min-width: 0; }
.ta-metric:first-child { border-left: 0; }
.ta-metric span { display: block; font-size: 12px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--text-muted); }
.ta-metric strong { display: block; margin-top: 6px; font-size: 26px; font-weight: 700; color: var(--brand); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ta-tier { min-width: 120px; }
.ta-tier .dt-select { height: 34px; font-size: 13.5px; }
.ta-owner { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.ta-ini { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; font-size: 11px; font-weight: 700; color: var(--text); background: var(--surface-3); border-radius: 50%; }
.ta-charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.ta-chart { padding: 18px 20px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); min-width: 0; }
.ta-chart h3 { margin: 0 0 14px; font-size: 15px; }
.ta-bars { display: flex; flex-direction: column; gap: 10px; }
.ta-bar { display: grid; grid-template-columns: minmax(80px, 140px) minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 13.5px; }
.ta-bar__lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ta-bar__track { display: block; height: 14px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.ta-bar__fill { display: block; height: 100%; background: var(--brand); border-radius: 4px; }
.ta-bar__val { font-weight: 600; white-space: nowrap; }
.ta-pick-list { max-height: 50vh; overflow-y: auto; border: 1px solid #e4e7ec; border-radius: var(--radius-sm); }
.ta-pick { display: grid; grid-template-columns: 24px minmax(0, 1fr) 150px; gap: 10px; align-items: center; padding: 10px 12px; border-bottom: 1px solid #e4e7ec; font-size: 14px; }
.ta-pick:last-child { border-bottom: 0; }
.ta-pick .dt-select { height: 34px; }

/* ============================================================== DATA CLEANUP */
.dc-intro { display: flex; align-items: center; gap: 20px; padding: 22px 24px; margin-bottom: 26px; border: 1px solid var(--border-strong); border-radius: var(--radius-lg); background: var(--surface); }
.dc-intro svg { width: 92px; height: 92px; flex: none; }
.dc-intro > div { flex: 1; min-width: 0; }
.dc-intro h2 { margin: 0 0 6px; font-size: 21px; }
.dc-intro p { margin: 0; color: var(--text-muted); font-size: 14.5px; }
.dc-type { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; font-size: 16px; font-weight: 700; }
.dc-type .dt-select { width: auto; min-width: 190px; }
.dc-list { border: 1px solid var(--border-strong); border-radius: var(--radius-lg); overflow: hidden; background: var(--surface); }
.dc-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) auto; gap: 16px; align-items: center; padding: 14px 20px; border-top: 1px solid var(--border); }
.dc-row:first-child { border-top: 0; }
.dc-row__name { font-size: 15.5px; font-weight: 700; }
.dc-row__status { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dc-row__acts { display: flex; gap: 8px; }
.dc-other { margin-top: 30px; }
.dc-other__item { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0; border-top: 1px solid var(--border); }
.dc-other__item:first-of-type { border-top: 0; }
.dc-other__item strong { display: block; font-size: 15px; margin-bottom: 4px; }
.dc-other__item p { margin: 0; color: var(--text-muted); font-size: 14px; }
.dc-crit { max-width: 900px; }
.dc-crit ul { margin: 4px 0 18px; padding-left: 22px; list-style: disc; font-size: 14.5px; }
.dc-label { display: block; margin: 0 0 10px; font-size: 16px; font-weight: 700; }
.dc-filters { margin: 22px 0 26px; padding: 4px 4px 0; }
.dc-filters__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.dc-frow { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.2fr) 36px; gap: 8px; align-items: center; margin-bottom: 8px; }
.dc-and { margin: 2px 0 8px; font-size: 12.5px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.dc-preview-h { margin: 0 0 10px; font-size: 15px; font-weight: 700; }
.dc-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; flex-wrap: wrap; }
.dc-active { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ============================================================= responsive */
@media (max-width: 1100px) {
  .ta-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 16px; }
  .ta-metric:nth-child(4) { border-left: 0; }
}
@media (max-width: 900px) {
  .md-layout { grid-template-columns: minmax(0, 1fr); padding: 16px; }
  .md-rules { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .md-rule { width: auto; }
  .mm-grid { grid-template-columns: minmax(0, 1fr); padding: 14px; }
  .mm-arrow svg { transform: rotate(90deg); }
  .ta-charts { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .dt { padding: 16px 16px 48px; }
  .dt-h1 { font-size: 22px; }
  .dt-head { flex-direction: column; align-items: stretch; }
  .dt-head .dt-actions { width: 100%; }
  .dt-head .dt-actions .dt-btn { flex: 1 1 0; }
  .dt-search, .dt-search input { width: 100%; }
  .rr-filters { flex-direction: column; align-items: stretch; }
  .rr-range { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
  .rr-range__lbl { grid-column: 1 / -1; }
  .rr-date, .rr-date .dt-input { width: 100%; }
  .rr-range .dt-input { width: 100%; }
  .rr-user { width: 100%; }
  .rr-rowact { visibility: visible; }
  .rr-namecell { flex-direction: column; align-items: flex-start; gap: 4px; }
  .dt-modal-ov { padding: 0; align-items: flex-end; }
  .dt-modal { max-height: 94vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .dt-modal__head, .dt-modal__body, .dt-modal__foot { padding-left: 16px; padding-right: 16px; }
  .dt-modal__foot .dt-btn { flex: 1 1 auto; }
  .mm-prim { grid-template-columns: minmax(0, 1fr); }
  .mm-row { grid-template-columns: minmax(0, 1fr) 24px minmax(0, 1fr); }
  .mm-pos { width: 100%; margin: 0; }
  .md-acts { flex-direction: row; }
  .md-rec__txt .dt-name { max-width: 180px; }
  .ta-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ta-metric { border-left: 0; }
  .ta-metric strong { font-size: 21px; }
  .ta-view { padding: 0 12px; font-size: 13.5px; }
  .ta-pick { grid-template-columns: 24px minmax(0, 1fr); }
  .ta-pick .dt-select { grid-column: 2; }
  .ta-bar { grid-template-columns: minmax(70px, 100px) minmax(0, 1fr) auto; }
  .dc-intro { flex-direction: column; align-items: flex-start; padding: 18px; }
  .dc-intro .dt-btn { width: 100%; }
  .dc-row { grid-template-columns: minmax(0, 1fr) auto; padding: 14px 16px; }
  .dc-row__status { grid-column: 1 / -1; grid-row: 2; }
  .dc-other__item { flex-direction: column; align-items: flex-start; }
  .dc-frow { grid-template-columns: minmax(0, 1fr) 36px; }
  .dc-frow > :nth-child(2), .dc-frow > :nth-child(3) { grid-column: 1; }
  .dc-frow > :nth-child(4) { grid-column: 2; grid-row: 1; }
  .dc-foot .dt-btn { flex: 1 1 0; }
  .dt-pager .dt-select { margin-left: 0; }
  .dt-tablewrap > .dt-table { min-width: 620px; }
  .ta-views { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .ta-views::-webkit-scrollbar { display: none; }
  .ta-view { flex: none; }
  .ta-filters { gap: 4px; }
  .ta-filters > span[style] { display: none; }
}

/* ---------------------------------------------------------------------------
 *  Cleanup criteria: filter groups + property picker (data-cleanup.js)
 * ------------------------------------------------------------------------- */
.dc-crit .dc-back { margin-bottom: 8px; }
.dc-nofilters { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 14px 0 6px; font-size: 14.5px; }
.dc-nofilters p { margin: 0; }
.dc-addbtn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; font: inherit; font-size: 14px; font-weight: 600; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); cursor: pointer; white-space: nowrap; }
.dc-addbtn:hover, .dc-addbtn[aria-expanded="true"] { background: var(--surface-hover); }
.dc-addbtn svg { width: 15px; height: 15px; }
.dc-addbtn:focus-visible, .dc-dd:focus-visible, .dc-ibtn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.dc-group { padding: 16px 12px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-lg, 12px); background: var(--surface); }
.dc-group__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 12px; padding: 0 0 0 2px; }
.dc-group__head h3 { margin: 0; font-size: 16px; font-weight: 700; }
.dc-group__acts { display: flex; gap: 4px; }
.dc-ibtn { display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0; color: var(--text-muted); background: none; border: 0; border-radius: var(--radius-sm); cursor: pointer; }
.dc-ibtn:hover { background: var(--surface-hover); color: var(--text); }
.dc-ibtn svg { width: 17px; height: 17px; }
.dc-cond { display: grid; grid-template-columns: minmax(0, 200px) minmax(0, 200px) minmax(0, 200px) 1fr; gap: 8px; align-items: center; margin: 0 0 8px 52px; padding: 8px; background: var(--surface-2); border-radius: var(--radius-sm); }
.dc-cond__x { justify-self: end; }
.dc-cond__gap { display: block; }
.dc-dd { display: inline-flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; height: 40px; padding: 0 12px; font: inherit; font-size: 14px; color: var(--text); text-align: left; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); cursor: pointer; }
.dc-dd span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dc-dd svg { flex: none; width: 16px; height: 16px; }
.dc-dd:hover, .dc-dd[aria-expanded="true"] { border-color: var(--brand); }
.dc-dd.is-ph span { color: var(--text-muted); }
.dc-group .dc-and { display: flex; align-items: center; gap: 12px; margin: 0; padding: 8px; color: var(--text); font-size: 14px; letter-spacing: 0; text-transform: none; background: var(--surface-2); border-radius: var(--radius-sm); }
.dc-and__t { width: 32px; text-align: right; font-size: 14px; font-weight: 600; }
.dc-or { position: relative; display: flex; align-items: center; gap: 10px; margin: 0 0 0 24px; padding: 10px 0; }
.dc-or::before { content: ""; position: absolute; top: 0; bottom: 0; left: 22px; width: 1px; background: var(--border-strong); }
.dc-or--end::before { bottom: 50%; }
.dc-or__pill { position: relative; display: inline-grid; place-items: center; min-width: 44px; height: 32px; padding: 0 10px; font-size: 14px; font-weight: 600; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); }
.dc-sum { padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.dc-sum__h { margin: 0 0 6px; font-size: 14px; font-weight: 700; }
.dc-sum ul { margin: 0; padding-left: 20px; list-style: disc; font-size: 14px; }
.dc-or-t { margin: 8px 0; font-size: 14px; font-weight: 600; }
.dc-psearch { margin: 0 0 12px; }
.dc-psearch input { width: 400px; }
.dc-ptable th { background: none; border-bottom: 1px solid var(--text); font-weight: 500; font-size: 14px; }
.dc-ptable td { padding: 18px 24px; }
.dc-ptable th { padding: 12px 24px; }
.dc-link { display: inline-flex; align-items: center; gap: 6px; color: var(--brand); font-weight: 600; text-decoration: none; }
.dc-link:hover { text-decoration: underline; }
.dc-link svg { width: 14px; height: 14px; flex: none; }
.dc-foot { justify-content: flex-end; }

/* property picker */
.dt-pop:has(.dc-pick) { max-height: none; overflow: visible; }
.dt-pop .dc-pick { display: flex; flex-direction: column; }
.dc-pick__search { margin: 6px 6px 8px !important; }
.dc-pick__search input { height: 40px !important; }
.dc-pick__tools { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 6px 6px; }
.dc-pick__tool { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px; font: inherit; font-size: 14px; font-weight: 600; color: var(--text); background: none; border: 0; border-radius: 6px; cursor: pointer; }
.dc-pick__tool:hover, .dc-pick__tool[aria-expanded="true"] { background: var(--surface-hover); }
.dc-pick__tool svg { width: 16px; height: 16px; }
.dc-pick__sub { position: absolute; top: 100%; z-index: 2; min-width: 220px; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: 0 12px 32px rgba(16, 24, 40, .16); }
.dc-pick__sub[hidden] { display: none; }
.dc-pick__list { flex: 1 1 auto; min-height: 0; max-height: min(320px, calc(100vh - 200px)); overflow-y: auto; }
.dc-pick__g { margin: 6px 0 2px; padding: 4px 10px; font-size: 14px; font-weight: 700; }
.dc-pick__item.is-current, .dt-menu__item.is-current { background: var(--surface-hover); font-weight: 600; }
.dc-pick__i { display: inline-grid; flex: none; place-items: center; width: 20px; height: 20px; color: var(--text-muted); }
.dc-pick__i svg { width: 16px; height: 16px; fill: currentColor; }
.dc-pick__none { margin: 10px; color: var(--text-muted); font-size: 14px; }
.dc-check[aria-checked]::after { content: none !important; }
.dc-check__box { flex: none; width: 18px; height: 18px; border: 1.5px solid var(--border-strong); border-radius: 4px; background: var(--surface); }
.dc-check[aria-checked="true"] .dc-check__box { border-color: var(--brand); background: var(--brand) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 5 5 9-10'/%3E%3C/svg%3E") center / 14px no-repeat; }
.dc-check__t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 760px) {
  .dc-cond { grid-template-columns: 1fr 36px; margin-left: 0; }
  .dc-cond .dc-dd { grid-column: 1; }
  .dc-cond__x { grid-column: 2; grid-row: 1; }
  .dc-cond__gap { display: none; }
  .dc-psearch input { width: 100%; }
}

/* Manage duplicates: locked bulk selection (Data Hub Professional) */
.md-lock { display: inline-flex; align-items: center; gap: 6px; }
.md-lock input { width: 16px; height: 16px; margin: 0; opacity: .45; cursor: not-allowed; }
.md-lockbtn { display: inline-grid; place-items: center; width: 22px; height: 22px; padding: 0; color: var(--text-muted); background: none; border: 0; border-radius: 4px; cursor: help; }
.md-lockbtn:hover { color: var(--text); background: var(--surface-hover); }
.md-lockbtn:focus-visible { outline: 0; box-shadow: var(--focus-ring); }
.md-lockbtn svg { width: 15px; height: 15px; }
.md-lockcol { width: 64px !important; }
/* dark mode: second record line and selected rows keep readable text */
[data-theme="dark"] .md-pair td, [data-theme="dark"] .md-pair .dt-line2 { color: var(--text); }
[data-theme="dark"] .md-pair .dt-line2 { color: var(--text-muted); }

/* Account Cleanup inside the Settings layout */
.dt.dc--settings { max-width: none; margin: 0; padding: 0; }
