:root {
  --bg: #f8fafc;
  --panel: #ffffff;
  --panel-2: #f9fbff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #eef1f5;
  --accent: #2563eb;
  --accent-d: #1d4ed8;
  --accent-soft: #eaf1ff;
  --green: #059669;
  --amber: #d97706;
  --red: #dc2626;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 22px rgba(15, 23, 42, .05);
  --shadow-lg: 0 10px 40px rgba(15, 23, 42, .16);
  --r: 12px;
  --side-w: 232px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 13.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.spacer { flex: 1; }
.error { color: var(--red); min-height: 1em; font-size: 13px; margin-top: 6px; }
a { color: var(--accent); }

/* ---------- Inputs & buttons ---------- */
input, textarea, select {
  background: var(--panel); border: 1px solid #dfe4ec; color: var(--ink);
  border-radius: 10px; padding: 10px 12px; font: inherit; width: 100%;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { min-height: 96px; resize: vertical; }
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px;
  font-weight: 600; color: #475569; margin-bottom: 12px; }

.btn {
  background: var(--panel); color: var(--ink); border: 1px solid #dfe4ec;
  border-radius: 10px; padding: 9px 14px; font: inherit; font-weight: 600; cursor: pointer;
  box-shadow: var(--shadow); transition: filter .15s, background .15s, transform .05s;
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
}
.btn:hover { background: #f4f7fb; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: transparent; color: #fff;
  box-shadow: 0 8px 20px rgba(37, 99, 235, .25); }
.btn.primary:hover { background: var(--accent-d); }
.btn.danger { background: var(--red); border-color: transparent; color: #fff; box-shadow: 0 8px 20px rgba(220,38,38,.22); }
.btn.danger:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.ghost:hover { background: #eef2f7; }
.btn.small { padding: 7px 11px; font-size: 12.5px; }
.btn.block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: radial-gradient(900px 420px at 50% -10%, #e7eefc 0, transparent 60%), var(--bg);
}
.login-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  padding: 30px 26px; width: 100%; max-width: 370px; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; gap: 6px;
}
.login-card .field { margin-top: 8px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.brand .mk, .logo .mk {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--accent), #60a5fa); box-shadow: 0 6px 16px rgba(37,99,235,.3);
}
.login-card > .muted { margin: 2px 0 6px; }
.login-card .btn.primary { margin-top: 8px; }
.demo-hint { font-size: 12px; color: var(--muted); text-align: center; margin-top: 10px; line-height: 1.7;
  border-top: 1px solid var(--line); padding-top: 12px; }

/* ---------- App shell ---------- */
#app { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100vh; }

.sidebar {
  background: var(--panel); border-right: 1px solid var(--line); padding: 18px 12px;
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
}
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 15px; padding: 6px 8px 18px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 9px;
  color: var(--muted); font-weight: 600; cursor: pointer; text-decoration: none; font-size: 13.5px;
}
.nav-item .ni-ico { width: 18px; text-align: center; }
.nav-item:hover { background: #f1f5f9; color: var(--ink); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.side-user {
  margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px;
  border: 1px solid var(--line); border-radius: 12px;
}
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-weight: 700; flex: none; }
.su-name { font-weight: 650; }
.su-role { font-size: 12px; color: var(--muted); text-transform: capitalize; }

.content { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  background: rgba(248, 250, 252, .85); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); padding: 12px 24px; min-height: 56px;
}
.page-title { font-weight: 700; font-size: 15px; }
.icon-btn { display: none; background: transparent; border: 0; font-size: 20px; cursor: pointer; color: var(--ink); padding: 4px 8px; }
main { padding: 22px 24px; max-width: 1120px; width: 100%; }

.scrim { display: none; }

/* ---------- Headings ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 12px; }
.page-head h2 { margin: 0; font-size: 21px; letter-spacing: -.01em; }
.page-head .sub { color: var(--muted); margin-top: 2px; font-size: 13px; }

/* ---------- Cards ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow); margin-bottom: 16px; overflow: hidden; }
.card > h3 { margin: 0; padding: 14px 18px; font-size: 14.5px; border-bottom: 1px solid var(--line); }
.card .card-body { padding: 16px 18px; }
.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* ---------- Rows / list items ---------- */
.list-item { display: flex; align-items: center; gap: 14px; padding: 13px 18px;
  border-bottom: 1px solid var(--line); cursor: pointer; }
.card .list-item:last-child { border-bottom: 0; }
.list-item:hover { background: var(--panel-2); }
.list-item .li-main { flex: 1; min-width: 0; }
.li-title { font-weight: 650; }
.li-sub { font-size: 12.5px; color: var(--muted); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------- Tables ---------- */
table.tbl { width: 100%; border-collapse: collapse; }
table.tbl th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); font-weight: 700; padding: 11px 16px; border-bottom: 1px solid var(--line); background: var(--panel-2); }
table.tbl td { padding: 12px 16px; border-bottom: 1px solid var(--line); }
table.tbl tbody tr:last-child td { border-bottom: 0; }
table.tbl tbody tr.clickable { cursor: pointer; }
table.tbl tbody tr.clickable:hover { background: var(--panel-2); }
.cust { display: flex; align-items: center; gap: 11px; }
.c-avatar { width: 34px; height: 34px; border-radius: 9px; background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: none; }
.c-name { font-weight: 650; }
.c-sub { color: var(--muted); font-size: 12px; }
.chev { color: #cbd5e1; }

/* ---------- Segmented filter ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.toolbar h3 { margin: 0; font-size: 14.5px; }
.seg { margin-left: auto; display: inline-flex; background: #eef2f7; border-radius: 9px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 7px; font: inherit;
  font-weight: 600; color: var(--muted); cursor: pointer; font-size: 12.5px; }
.seg button.on { background: #fff; color: var(--ink); box-shadow: var(--shadow); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px;
  font-size: 11.5px; font-weight: 700; background: #eef2f7; color: var(--muted); }
.badge.dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.onsite { background: #e7f6ef; color: #047857; }
.badge.nearby { background: #fdf1e1; color: #b45309; }
.badge.outside { background: #fce9e9; color: #b91c1c; }
.badge.unknown { background: #eef2f7; color: var(--muted); }
.badge.overdue { background: #fce9e9; color: #b91c1c; }
.badge.today { background: var(--accent-soft); color: var(--accent); }
.badge.fresh { background: #e7f6ef; color: #047857; }
.badge.stale { background: #eef2f7; color: var(--muted); }
.badge.never { background: #fce9e9; color: #b91c1c; }

/* ---------- Stat / KPI ---------- */
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); }
.stat .num { font-size: 25px; font-weight: 800; letter-spacing: -.02em; }
.stat .lbl { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------- Timeline ---------- */
.timeline { position: relative; padding-left: 20px; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 4px; bottom: 4px; width: 2px; background: var(--line); }
.tl-item { position: relative; margin-bottom: 16px; }
.tl-item::before { content: ""; position: absolute; left: -20px; top: 3px; width: 11px; height: 11px;
  border-radius: 50%; background: var(--accent); border: 2px solid var(--panel); box-shadow: 0 0 0 2px var(--panel); }
.tl-item.visit::before { background: var(--green); }
.tl-item.note::before { background: #7c3aed; }
.tl-item.call::before { background: var(--amber); }
.tl-item.followup::before { background: var(--red); }
.tl-item.document::before { background: #94a3b8; }
.tl-head { font-weight: 650; font-size: 13.5px; }
.tl-meta { font-size: 12px; color: var(--muted); }
.tl-body { font-size: 13px; margin-top: 3px; white-space: pre-wrap; color: #334155; }

/* ---------- Map ---------- */
#map, .mini-map { width: 100%; height: 400px; border-radius: var(--r); border: 1px solid var(--line); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; margin: 4px 0 12px; color: var(--muted); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }

/* ---------- Recorder ---------- */
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--red); display: inline-block; }
.rec-dot.live { animation: pulse 1s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: flex;
  align-items: center; justify-content: center; padding: 24px 16px; z-index: 80; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; width: 100%;
  max-width: 520px; padding: 22px; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px); }
.modal.wide { max-width: 880px; }
.modal h3 { margin: 0 0 14px; }
/* Side/top padding keeps input focus rings from being clipped by the scroll container. */
.modal-body { overflow-y: auto; min-height: 0; flex: 1; margin: 0 -22px; padding: 4px 22px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center;
  margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.modal-actions .modal-error { margin: 0 auto 0 0; }

/* Multi-column form rows; inputs line up along the bottom even when a label wraps. */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; align-items: end; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid .span-3 { grid-column: span 3; }
.form-grid .span-all { grid-column: 1 / -1; }
.form-grid .field-btn { margin-bottom: 12px; }
.form-grid .field-btn .btn { width: 100%; padding-block: 10px; }
textarea.short { min-height: 60px; }
@media (max-width: 760px) {
  .form-grid.cols-3, .form-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid .span-3 { grid-column: 1 / -1; }
}
@media (max-width: 480px) {
  .form-grid, .form-grid.cols-3, .form-grid.cols-4 { grid-template-columns: 1fr; }
}

/* ---------- Toast ---------- */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink);
  color: #fff; padding: 11px 18px; border-radius: 11px; box-shadow: var(--shadow-lg); z-index: 100;
  max-width: 90%; font-size: 13.5px; font-weight: 500; }
.toast.ok { background: #065f46; }
.toast.err { background: #991b1b; }

.tag-ai { font-size: 11px; background: #f3ecff; color: #7c3aed; padding: 1px 8px; border-radius: 99px; font-weight: 700; }
.empty { color: var(--muted); text-align: center; padding: 34px; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  #app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 70; top: 0; bottom: 0; left: 0; width: 250px; height: 100vh;
    transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .scrim.show { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .4); z-index: 65; }
  .icon-btn { display: inline-flex; }
  main { padding: 16px; }
  .topbar { padding: 12px 16px; }
}
@media (max-width: 560px) {
  .hide-sm { display: none !important; }
  table.tbl th, table.tbl td { padding: 10px 12px; }
}

/* ---------- KYC, Probe42 & trade profiles ---------- */
.card-head { display: flex; align-items: center; gap: 10px; padding: 11px 18px; border-bottom: 1px solid var(--line); min-height: 50px; }
.card-head h3 { margin: 0; font-size: 14.5px; }
.badge.type-buyer { background: var(--accent-soft); color: var(--accent); }
.badge.type-seller { background: #f3ecff; color: #7c3aed; }
.badge.type-both { background: #e7f6ef; color: #047857; }
.tag-demo { font-size: 11px; background: #fdf1e1; color: #b45309; padding: 1px 8px; border-radius: 99px; font-weight: 700; }

.kv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px 18px; }
.kv-l { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; }
.kv-v { margin-top: 2px; word-break: break-word; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .02em; }
.checklist { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.check { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 99px; }
.check.ok { background: #e7f6ef; color: #047857; }
.check.todo { background: #eef2f7; color: var(--muted); }

.score-pill { display: inline-flex; align-items: baseline; padding: 2px 9px; border-radius: 99px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.score-pill b { font-size: 13px; }
.score-pill.high { background: #e7f6ef; } .score-pill.high b { color: #047857; }
.score-pill.mid { background: #fdf1e1; } .score-pill.mid b { color: #b45309; }
.score-pill.low { background: #fce9e9; } .score-pill.low b { color: #b91c1c; }
.rank { font-weight: 800; font-size: 12px; color: var(--ink); background: #eef2f7; border-radius: 6px; padding: 1px 6px; }
.rank.big { font-size: 15px; padding: 2px 8px; }

.score-row { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.score-big { width: 104px; height: 104px; border-radius: 50%; display: grid; place-content: center; text-align: center; flex: none;
  background: #eef2f7; border: 6px solid #cbd5e1; }
.score-big.high { border-color: var(--green); background: #e7f6ef; }
.score-big.mid { border-color: var(--amber); background: #fdf1e1; }
.score-big.low { border-color: var(--red); background: #fce9e9; }
.sb-num { font-size: 28px; font-weight: 800; letter-spacing: -.02em; line-height: 1; }
.sb-lbl { font-size: 11.5px; font-weight: 700; color: var(--muted); margin-top: 4px; }
.score-side { flex: 1; min-width: 200px; }
.meter { height: 8px; border-radius: 99px; background: #eef2f7; overflow: hidden; }
.meter-fill { height: 100%; border-radius: 99px; background: #94a3b8; }
.meter-fill.high { background: var(--green); } .meter-fill.mid { background: var(--amber); } .meter-fill.low { background: var(--red); }
.meter-scale { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); margin-top: 4px; }

.sort-sel { width: auto; padding: 6px 10px; font-size: 12.5px; }
.toolbar .seg { flex-wrap: wrap; }
fieldset.kyc-set { border: 1px solid #dfe4ec; border-radius: 12px; padding: 10px 14px 4px; margin: 0 0 12px; }
fieldset.kyc-set legend { font-size: 12px; font-weight: 700; color: var(--accent); padding: 0 6px; }
fieldset.kyc-set .error:empty { display: none; }
fieldset.kyc-set .error { margin: -4px 0 10px; }
.field-label { font-size: 12.5px; font-weight: 600; color: #475569; margin-bottom: 6px; }
.product-rows { display: flex; flex-direction: column; gap: 6px; }
.product-row { display: grid; grid-template-columns: 1.7fr 1.3fr 1fr 1fr .8fr auto; gap: 6px; align-items: center; }
.product-row.head { font-size: 11.5px; font-weight: 600; color: var(--muted); padding: 0 2px; }
.product-row input, .product-row select { padding: 8px 9px; }
@media (max-width: 560px) {
  .product-row { grid-template-columns: 1fr 1fr; }
  .product-row .pr-product { grid-column: 1 / -1; }
  .product-row.head { display: none; }
}

/* ---------- Invoices ---------- */
.tl-item.invoice::before { background: #0891b2; }
.inv-warn { background: #fdf1e1; color: #8a5200; border-radius: 10px; padding: 10px 12px; font-size: 12.5px; }
.inv-warn ul { margin: 6px 0 0; padding-left: 18px; }
.num-col { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.busy { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; }
.busy::before { content: ""; width: 13px; height: 13px; border-radius: 50%; border: 2px solid #cbd5e1;
  border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Charts ---------- */
/* One hue for magnitude; the numbers sit beside every bar so the chart is also its own table. */
.chart-note { font-size: 12px; color: var(--muted); margin-top: 10px; }
.bar-rows { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: grid; grid-template-columns: minmax(96px, 1.3fr) minmax(60px, 3fr) auto; gap: 12px; align-items: center; }
.bar-row .bar-l { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 10px; border-radius: 4px; background: #eef2f7; }
.bar-fill { height: 100%; min-width: 2px; background: var(--accent); border-radius: 0 4px 4px 0; }
.bar-fill.warn { background: var(--amber); }
.bar-fill.bad { background: var(--red); }
.bar-val { font-size: 12.5px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar-sub { font-size: 11.5px; color: var(--muted); }

.col-chart { display: flex; align-items: flex-end; gap: 8px; height: 148px; }
.col { flex: 1; min-width: 24px; display: flex; flex-direction: column; justify-content: flex-end;
  align-items: center; gap: 6px; height: 100%; }
.col .col-bar { width: 100%; max-width: 40px; min-height: 2px; background: var(--accent); border-radius: 4px 4px 0 0; }
.col .col-lbl { font-size: 11px; color: var(--muted); white-space: nowrap; }
.col-base { border-top: 1px solid var(--line); margin-top: 6px; }

.spark-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 300px)); gap: 16px; }
.spark-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.spark-title { font-weight: 650; font-size: 13px; }
.spark-now { font-size: 18px; font-weight: 800; letter-spacing: -.01em; margin-top: 2px; }
.spark svg { display: block; width: 100%; height: 64px; overflow: visible; }
.spark .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark .pt { fill: var(--accent); stroke: var(--panel); stroke-width: 2; }
.spark-scale { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 4px; }

/* ---------- Search ---------- */
.search-input { width: 100%; padding: 9px 12px 9px 34px; border-radius: 10px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E") no-repeat 11px 50%; }
.search-bar { padding: 10px 16px; border-bottom: 1px solid var(--line); }
.toolbar .search-input { flex: 1 1 240px; min-width: 200px; width: auto; }
.tl-count { font-size: 12.5px; white-space: nowrap; }

/* ---------- Profile form ---------- */
.notice { background: #fdf1e1; color: #8a5200; border-radius: 10px; padding: 9px 12px; font-size: 12.5px; margin-bottom: 8px; }
.notice a { color: inherit; font-weight: 600; }
.vol-sum:empty { display: none; }
.vol-sum { margin: 2px 0 4px; }

/* ---------- Master list ---------- */
.master-add { display: grid; grid-template-columns: 1fr 2fr auto; gap: 10px; align-items: center; }
@media (max-width: 700px) { .master-add { grid-template-columns: 1fr; } }
.master-add + .error:empty { display: none; }
.master-rows { display: flex; flex-direction: column; }
.master-row { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.master-row:last-child { border-bottom: 0; }
.master-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.master-name { font-weight: 650; font-size: 14.5px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip { display: inline-flex; align-items: center; background: var(--accent-soft); color: var(--accent);
  border-radius: 999px; font-size: 12.5px; font-weight: 550; }
.chip-label { padding: 4px 4px 4px 11px; cursor: pointer; }
.chip-label:hover { text-decoration: underline; }
.chip-x { border: 0; background: transparent; color: inherit; cursor: pointer; font-size: 15px; line-height: 1;
  padding: 3px 9px 4px 4px; border-radius: 999px; opacity: .65; }
.chip-x:hover { opacity: 1; color: var(--red); }
.chip-input { width: 150px; padding: 4px 10px; font-size: 12.5px; border-radius: 999px; border: 1px dashed #c3ccd9; background: #fff; }

/* ---------- Users & orgs ---------- */
.badge.role-super_admin { background: #1e293b; color: #fff; }
.badge.role-org_admin { background: #f3ecff; color: #7c3aed; }
.badge.role-manager { background: var(--accent-soft); color: var(--accent); }
.badge.role-salesperson { background: #eef2f7; color: var(--muted); }
.inactive-row td { opacity: .55; }
.inactive-row td:last-child { opacity: 1; }
.btn.danger-text { color: var(--red); }
.btn.danger-text.armed { background: var(--red); color: #fff; border-color: transparent; }
.role-help { font-size: 13px; padding: 3px 0; color: #334155; }
