/* ─── Nutcat Partners — Google-style design system ───────────────────────────
   Reference product: Google AdSense. Light surfaces, one accent (Nutcat orange),
   Roboto/Google-Sans-style type, left nav rail, cards, clean data tables. */

:root {
  --bg: #f8f9fa;
  --surface: #ffffff;
  --text: #202124;
  --text-2: #5f6368;
  --text-3: #80868b;
  --divider: #dadce0;
  --divider-soft: #e8eaed;
  --accent: #1a73e8;          /* friendly Google blue (brand accent) */
  --accent-dark: #185abc;
  --accent-soft: #e8f0fe;
  --orange: #e8710a;          /* kept as a CATEGORICAL color (in-app purchases) */
  --blue: #1a73e8;
  --blue-soft: #e8f0fe;
  --green: #188038;
  --green-soft: #e6f4ea;
  --red: #d93025;
  --red-soft: #fce8e6;
  --yellow: #e37400;
  --yellow-soft: #fef7e0;
  --shadow-1: 0 1px 2px rgba(60,64,67,.3), 0 1px 3px 1px rgba(60,64,67,.15);
  --shadow-2: 0 1px 3px rgba(60,64,67,.3), 0 4px 8px 3px rgba(60,64,67,.15);
  --radius: 8px;
  --nav-w: 256px;
  --font: "Roboto", "Google Sans Text", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button { font-family: var(--font); }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
.hidden { display: none !important; }

.material-symbols-outlined {
  font-variation-settings: "FILL" 0, "wght" 300, "GRAD" 0, "opsz" 24;
  font-size: 22px; line-height: 1; user-select: none;
}

/* ─── App shell ─── */
#app { display: none; min-height: 100vh; }
#app.ready { display: block; }

/* Left nav rail */
.nav-rail {
  position: fixed; inset: 0 auto 0 0; width: var(--nav-w);
  background: var(--surface); border-right: 1px solid var(--divider-soft);
  display: flex; flex-direction: column; z-index: 40;
  transition: transform .2s ease;
}
.nav-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 20px 14px;
}
.nav-brand .logo-mark {
  width: 34px; height: 34px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #5d9cf5);
  color: #fff; display: grid; place-items: center;
  font-weight: 700; font-size: 17px;
}
.nav-brand .logo-name { font-size: 16px; font-weight: 500; letter-spacing: .2px; }
.nav-brand .logo-name small { display: block; font-size: 11px; font-weight: 400; color: var(--text-3); letter-spacing: .8px; text-transform: uppercase; }

.nav-items { flex: 1; overflow-y: auto; padding: 6px 8px 16px; }
.nav-item {
  display: flex; align-items: center; gap: 14px;
  width: 100%; border: 0; background: none; cursor: pointer; text-align: left;
  padding: 9px 14px; margin: 1px 0; border-radius: 0 24px 24px 0;
  font-size: 13.5px; font-weight: 400; color: var(--text);
}
.nav-item .material-symbols-outlined { color: var(--text-2); font-size: 20px; }
.nav-item:hover { background: #f1f3f4; }
.nav-item.active { background: var(--accent-soft); color: var(--accent-dark); font-weight: 500; }
.nav-item.active .material-symbols-outlined { color: var(--accent-dark); font-variation-settings: "FILL" 1, "wght" 300; }
.nav-section { padding: 16px 16px 6px; font-size: 11px; font-weight: 500; letter-spacing: .8px; color: var(--text-3); text-transform: uppercase; }
.nav-foot { padding: 12px 16px; border-top: 1px solid var(--divider-soft); font-size: 11.5px; color: var(--text-3); }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 30;
  margin-left: var(--nav-w);
  display: flex; align-items: center; gap: 12px;
  background: var(--bg); padding: 10px 24px;
  border-bottom: 1px solid transparent;
}
.topbar.scrolled { background: var(--surface); border-bottom-color: var(--divider-soft); box-shadow: 0 1px 2px rgba(60,64,67,.1); }
.iconbtn.menu-btn { display: none; }
.page-title { font-size: 20px; font-weight: 400; color: var(--text); margin-right: auto; }

.searchbox {
  display: flex; align-items: center; gap: 8px;
  background: #f1f3f4; border-radius: 24px; padding: 8px 16px;
  min-width: 220px; max-width: 340px; flex: 1;
}
.searchbox input { border: 0; background: none; outline: none; font: inherit; width: 100%; color: var(--text); }
.searchbox .material-symbols-outlined { font-size: 20px; color: var(--text-2); }

.iconbtn {
  border: 0; background: none; cursor: pointer; position: relative;
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  color: var(--text-2);
}
.iconbtn:hover { background: #f1f3f4; }
.iconbtn .dot {
  position: absolute; top: 7px; right: 7px; min-width: 15px; height: 15px; padding: 0 3px;
  background: var(--red); border-radius: 8px; color: #fff;
  font-size: 10px; font-weight: 500; display: grid; place-items: center;
}
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 13px; font-weight: 500;
  display: grid; place-items: center; cursor: pointer; border: 0;
}

/* Impersonation banner */
.impersonation {
  position: sticky; top: 0; z-index: 45;
  margin-left: var(--nav-w);
  background: var(--yellow-soft); color: #7a4d05;
  padding: 8px 24px; font-size: 13px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid #f3d9a4;
}
.impersonation button#impersonation-stop {
  margin-left: auto; border: 1px solid #d9b25f; background: #fff;
  border-radius: 16px; padding: 4px 14px; font-size: 12.5px; cursor: pointer; color: #7a4d05;
}
.impersonation button#impersonation-back {
  border: 1px solid #d9b25f; background: #fff; color: #7a4d05; cursor: pointer;
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none;
}
.impersonation button#impersonation-back:hover, .impersonation button#impersonation-stop:hover { background: #fff8ea; }

/* Main area */
.main { margin-left: var(--nav-w); padding: 12px 24px 48px; max-width: 1240px; }

/* ─── Cards & layout ─── */
.card {
  background: var(--surface); border: 1px solid var(--divider-soft);
  border-radius: var(--radius); padding: 20px 24px; margin-bottom: 16px;
}
.card h3 { font-size: 15px; font-weight: 500; margin-bottom: 4px; }
.card .sub { font-size: 12.5px; color: var(--text-2); margin-bottom: 14px; }
.grid { display: grid; gap: 16px; margin-bottom: 16px; }
.grid.cols-2 { grid-template-columns: 1fr 1fr; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }

/* Hero stat (AdSense-style big number) */
.hero {
  background: var(--surface); border: 1px solid var(--divider-soft); border-radius: var(--radius);
  padding: 22px 24px; margin-bottom: 16px;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 40px 64px; flex-wrap: wrap;
}
.hero .headline { min-width: 220px; }
.hero .headline .label { font-size: 13px; color: var(--text-2); }
.hero .headline .value { font-size: 40px; font-weight: 400; letter-spacing: -.5px; margin-top: 2px; }
.hero .headline .delta { font-size: 12.5px; color: var(--text-2); margin-top: 4px; }

/* KPI tiles */
.tile { background: var(--surface); border: 1px solid var(--divider-soft); border-radius: var(--radius); padding: 16px 20px; }
.tile .label { font-size: 12.5px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.tile .value { font-size: 24px; font-weight: 400; margin-top: 6px; }
.tile .foot { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.tile.accent { border-top: 3px solid var(--accent); }

/* Chips (Google date-range style) */
.chip-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.chip {
  border: 1px solid var(--divider); background: var(--surface); cursor: pointer;
  border-radius: 8px; padding: 7px 14px; font-size: 13px; color: var(--text);
  display: inline-flex; align-items: center; gap: 6px;
}
.chip:hover { background: #f8f9fa; }
.chip.on { background: var(--blue-soft); border-color: var(--blue-soft); color: #185abc; font-weight: 500; }
.chip .material-symbols-outlined { font-size: 18px; }

/* Buttons */
.btn {
  border: 1px solid var(--divider); background: var(--surface); color: var(--blue);
  font-size: 13.5px; font-weight: 500; border-radius: 20px; padding: 8px 20px;
  cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
}
.btn:hover { background: var(--blue-soft); border-color: var(--blue-soft); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn.danger { color: var(--red); }
.btn.danger:hover { background: var(--red-soft); border-color: var(--red-soft); }
.btn.small { padding: 5px 14px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn .material-symbols-outlined { font-size: 18px; }

/* Tables (Google Analytics style) */
.tablewrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  text-align: left; font-size: 11.5px; font-weight: 500; letter-spacing: .3px;
  color: var(--text-2); text-transform: uppercase;
  padding: 10px 12px; border-bottom: 1px solid var(--divider);
  white-space: nowrap;
}
table.data td { padding: 12px; border-bottom: 1px solid var(--divider-soft); vertical-align: middle; }
table.data tr:hover td { background: #f8f9fa; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data .rowactions { visibility: hidden; white-space: nowrap; }
table.data tr:hover .rowactions, table.data tr:focus-within .rowactions { visibility: visible; }
.empty { text-align: center; color: var(--text-3); padding: 36px 12px; font-size: 13.5px; }

/* Status chips */
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; border-radius: 12px; padding: 3px 10px; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status.active { background: var(--green-soft); color: var(--green); }
.status.applied { background: var(--yellow-soft); color: #9a5300; }
.status.paused { background: #f1f3f4; color: var(--text-2); }
.status.banned { background: var(--red-soft); color: var(--red); }
.status.pending { background: var(--yellow-soft); color: #9a5300; }
.status.approved { background: var(--blue-soft); color: #185abc; }
.status.paid { background: var(--green-soft); color: var(--green); }
.status.clawed_back { background: var(--red-soft); color: var(--red); }
.status.draft { background: #f1f3f4; color: var(--text-2); }
.status.sent { background: var(--blue-soft); color: #185abc; }

.role-badge { font-size: 11px; font-weight: 500; letter-spacing: .4px; text-transform: uppercase; color: var(--text-2); background: #f1f3f4; border-radius: 4px; padding: 2px 7px; }
.role-badge.director { background: #ede7f6; color: #5e35b1; }
.role-badge.manager { background: var(--blue-soft); color: #185abc; }
.role-badge.affiliate { background: var(--green-soft); color: var(--green); }
.role-badge.admin { background: var(--accent-soft); color: var(--accent-dark); }

/* Forms */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 500; color: var(--text-2); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--divider); border-radius: 6px;
  padding: 10px 12px; font: inherit; color: var(--text); background: var(--surface);
  outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.field .hint { font-size: 11.5px; color: var(--text-3); margin-top: 4px; }
.field.error input { border-color: var(--red); }
.form-row { display: flex; gap: 12px; }
.form-row .field { flex: 1; }

/* Dialogs */
dialog {
  border: 0; border-radius: 12px; box-shadow: var(--shadow-2);
  padding: 0; max-width: 480px; width: calc(100vw - 48px);
  margin: auto;   /* centre in the viewport (reset had zeroed it) */
}
dialog::backdrop { background: rgba(32,33,36,.5); }
.dialog-head { padding: 20px 24px 0; }
.dialog-head h2 { font-size: 17px; font-weight: 500; }
.dialog-head .sub { font-size: 13px; color: var(--text-2); margin-top: 4px; }
.dialog-body { padding: 16px 24px; max-height: 65vh; overflow-y: auto; }
.dialog-foot { padding: 12px 24px 20px; display: flex; justify-content: flex-end; gap: 10px; }

/* Toast */
#toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(80px);
  background: #323639; color: #fff; font-size: 13.5px;
  border-radius: 8px; padding: 12px 20px; box-shadow: var(--shadow-2);
  transition: transform .25s ease; z-index: 100; max-width: 90vw;
}
#toast.show { transform: translateX(-50%) translateY(0); }
#toast.error { background: var(--red); }

/* Menus */
.menu {
  position: absolute; background: var(--surface); border-radius: 8px;
  box-shadow: var(--shadow-2); padding: 6px 0; min-width: 200px; z-index: 60;
}
.menu button {
  display: flex; align-items: center; gap: 12px; width: 100%;
  border: 0; background: none; text-align: left; cursor: pointer;
  padding: 9px 16px; font-size: 13.5px; color: var(--text);
}
.menu button:hover { background: #f1f3f4; }
.menu button .material-symbols-outlined { font-size: 19px; color: var(--text-2); }
.menu hr { border: 0; border-top: 1px solid var(--divider-soft); margin: 6px 0; }

/* Notifications panel */
.panel {
  position: fixed; top: 56px; right: 20px; width: 360px; max-height: 480px; overflow-y: auto;
  background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-2); z-index: 70;
}
.panel .panel-head { padding: 14px 18px; font-weight: 500; font-size: 14px; border-bottom: 1px solid var(--divider-soft); display: flex; justify-content: space-between; align-items: center; }
.notif { padding: 12px 18px; border-bottom: 1px solid var(--divider-soft); font-size: 13px; }
.notif .t { font-weight: 500; }
.notif .b { color: var(--text-2); margin-top: 2px; }
.notif .when { color: var(--text-3); font-size: 11.5px; margin-top: 3px; }
.notif.unread { background: var(--blue-soft); }

/* Chart */
.chartbox { position: relative; }
.chartbox canvas { width: 100%; height: 260px; display: block; }
.chart-tip {
  position: absolute; pointer-events: none; background: #202124; color: #fff;
  font-size: 12px; border-radius: 6px; padding: 8px 12px; transform: translate(-50%, -110%);
  white-space: nowrap; display: none; z-index: 5;
}
.legend { display: flex; gap: 18px; font-size: 12.5px; color: var(--text-2); margin-top: 10px; flex-wrap: wrap; }
.legend .key { display: inline-flex; align-items: center; gap: 6px; }
.legend .swatch { width: 10px; height: 10px; border-radius: 2px; }

/* Funnel */
.funnel { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; }
.funnel .step { flex: 1; min-width: 130px; background: #f8f9fa; border-radius: 8px; padding: 14px 16px; position: relative; }
.funnel .step .n { font-size: 22px; font-weight: 400; }
.funnel .step .l { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.funnel .step .pct { font-size: 11.5px; color: var(--green); margin-top: 4px; }

/* Promo kit grid */
.kit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.kit-card { background: var(--surface); border: 1px solid var(--divider-soft); border-radius: 10px; overflow: hidden; }
.kit-card .thumb { aspect-ratio: 16/9; background: #f1f3f4 center/cover no-repeat; display: grid; place-items: center; color: var(--text-3); position: relative; }
.kit-card .thumb .kind { position: absolute; top: 8px; left: 8px; background: rgba(32,33,36,.75); color: #fff; font-size: 10.5px; letter-spacing: .5px; text-transform: uppercase; border-radius: 4px; padding: 3px 7px; }
.kit-card .body { padding: 12px 14px; }
.kit-card .body .t { font-size: 13.5px; font-weight: 500; }
.kit-card .body .m { font-size: 12px; color: var(--text-3); margin: 3px 0 10px; }

/* Referral link box */
.linkbox { display: flex; gap: 10px; align-items: center; background: #f8f9fa; border: 1px solid var(--divider-soft); border-radius: 8px; padding: 12px 16px; }
.linkbox code { font-family: "Roboto Mono", monospace; font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }

/* Org tree */
.tree ul { list-style: none; padding-left: 26px; border-left: 1px dashed var(--divider); margin-left: 9px; }
.tree > ul { border: 0; padding-left: 0; margin-left: 0; }
.tree .node { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; margin: 2px 0; }
.tree .node:hover { background: #f1f3f4; }
.tree .node .nm { font-weight: 500; font-size: 13.5px; }
.tree .node .meta { color: var(--text-3); font-size: 12px; }

/* Waterfall split visual */
.split { display: flex; height: 26px; border-radius: 6px; overflow: hidden; font-size: 11px; color: #fff; margin: 10px 0 4px; }
.split > div { display: grid; place-items: center; min-width: 34px; white-space: nowrap; padding: 0 4px; }
.split .s-aff { background: var(--green); }
.split .s-mid { background: var(--blue); }
.split .s-you { background: var(--accent); }
.split .s-co { background: #9aa0a6; }
.split-legend { display: flex; gap: 14px; font-size: 11.5px; color: var(--text-2); flex-wrap: wrap; }

/* Login screen */
#login-screen {
  min-height: 100vh; display: grid; place-items: center; background: var(--bg); padding: 24px;
}
.login-card {
  background: var(--surface); border: 1px solid var(--divider-soft); border-radius: 16px;
  width: 100%; max-width: 400px; padding: 44px 40px 36px; text-align: center;
}
.login-card .logo-mark {
  width: 52px; height: 52px; border-radius: 14px; margin: 0 auto 16px;
  background: linear-gradient(135deg, var(--accent), #5d9cf5);
  color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 26px;
}
.login-card h1 { font-size: 22px; font-weight: 400; margin-bottom: 4px; }
.login-card .sub { font-size: 13.5px; color: var(--text-2); margin-bottom: 26px; }
.login-card form { text-align: left; }
.login-card .btn.primary { width: 100%; justify-content: center; padding: 11px; border-radius: 8px; margin-top: 4px; }
.login-alt { margin: 18px 0 0; }
.login-sep { display: flex; align-items: center; gap: 12px; color: var(--text-3); font-size: 12px; margin: 18px 0; }
.login-sep::before, .login-sep::after { content: ""; flex: 1; border-top: 1px solid var(--divider-soft); }
#gsi-button { display: flex; justify-content: center; }
.login-links { margin-top: 22px; font-size: 13px; display: flex; justify-content: space-between; }
.login-err { background: var(--red-soft); color: var(--red); border-radius: 8px; padding: 10px 14px; font-size: 13px; margin-bottom: 14px; text-align: left; }

/* Loading */
.loading { display: grid; place-items: center; padding: 60px; color: var(--text-3); }
.spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid var(--divider-soft); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Responsive */
@media (max-width: 960px) {
  .nav-rail { transform: translateX(-100%); box-shadow: var(--shadow-2); }
  .nav-rail.open { transform: translateX(0); }
  .topbar, .main, .impersonation { margin-left: 0; }
  .iconbtn.menu-btn { display: grid; }
  .grid.cols-4 { grid-template-columns: 1fr 1fr; }
  .grid.cols-3 { grid-template-columns: 1fr; }
  .grid.cols-2 { grid-template-columns: 1fr; }
  .hero .headline .value { font-size: 32px; }
  .searchbox { display: none; }
  .main { padding: 12px 14px 48px; }
}
#scrim { position: fixed; inset: 0; background: rgba(32,33,36,.4); z-index: 35; }

/* keyboard focus ring (Material-style) */
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px;
}
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible { outline: none; }
.status.failed { background: var(--red-soft); color: var(--red); }
dialog.wide { max-width: 820px; }

/* expandable per-sale breakdown (gross → net → your share) */
.expand-cell { width: 34px; padding: 6px 0 6px 8px !important; }
button.expand { transition: transform .15s ease; }
button.expand.open { transform: rotate(180deg); }
tr.detail-row > td { background: #f8f9fa; padding: 4px 12px 14px 46px; }
table.data tr.detail-row:hover td { background: #f8f9fa; }
.bd { max-width: 400px; font-size: 13px; }
.bd .bd-row { display: flex; justify-content: space-between; gap: 24px; padding: 5px 0; }
.bd .bd-row.deduct { color: var(--text-2); }
.bd .bd-row.deduct span:last-child { color: var(--red); }
.bd .bd-row.total { border-top: 1px solid var(--divider); font-weight: 500; }
.bd .bd-row.mine { border-top: 1px solid var(--divider); }
.bd .bd-row.mine b { color: var(--green); }
.bd .bd-note { font-size: 11.5px; color: var(--text-3); margin-top: 6px; }

/* ─── View-only mode (viewing a team member's account) ─── */
.vo-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 700; letter-spacing: .8px;
  color: #7a4d05; background: #fff; border: 1px solid #e0b95c;
  border-radius: 6px; padding: 3px 9px; white-space: nowrap;
}
.vo-badge .material-symbols-outlined { font-size: 14px; }
body.viewonly .main .btn.primary, body.viewonly .main .btn.danger, body.viewonly .main [data-viewas] {
  opacity: .45; pointer-events: none;
}

/* ─── Reusable list toolbar (search · filters · sort · page size · pagination) ─── */
.listbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.listbar .lb-search {
  display: flex; align-items: center; gap: 8px; flex: 1; min-width: 220px; max-width: 380px;
  background: #f1f3f4; border: 1px solid transparent; border-radius: 24px; padding: 8px 14px;
}
.listbar .lb-search:focus-within { background: var(--surface); border-color: var(--divider); box-shadow: 0 1px 3px rgba(60,64,67,.12); }
.listbar .lb-search input { border: 0; background: none; outline: none; font: inherit; width: 100%; color: var(--text); }
.listbar .lb-search .material-symbols-outlined { font-size: 20px; color: var(--text-2); }
.listbar .lb-search .lb-clear { border: 0; background: none; cursor: pointer; color: var(--text-3); display: none; padding: 0; }
.listbar .lb-search.has-text .lb-clear { display: grid; place-items: center; }
.lb-select {
  position: relative; display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--divider); background: var(--surface); border-radius: 8px;
  padding: 0 8px 0 12px; height: 38px; font-size: 13px; color: var(--text); cursor: pointer;
}
.lb-select:hover { background: #f8f9fa; }
.lb-select.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-dark); }
.lb-select select { appearance: none; border: 0; background: none; outline: none; font: inherit; color: inherit; cursor: pointer; padding: 8px 20px 8px 0; }
.lb-select .material-symbols-outlined { position: absolute; right: 6px; font-size: 18px; color: var(--text-2); pointer-events: none; }
.lb-select .lb-lead { color: var(--text-3); }
.lb-spacer { flex: 1; }

.pager { display: flex; align-items: center; gap: 14px; justify-content: flex-end; margin-top: 14px; font-size: 13px; color: var(--text-2); flex-wrap: wrap; }
.pager .pager-count { margin-right: auto; }
.pager .pager-size { display: inline-flex; align-items: center; gap: 6px; }
.pager .pager-btns { display: inline-flex; gap: 4px; }
.pager .pager-btns button {
  border: 1px solid var(--divider); background: var(--surface); cursor: pointer;
  width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; color: var(--text-2);
}
.pager .pager-btns button:hover:not(:disabled) { background: #f8f9fa; }
.pager .pager-btns button:disabled { opacity: .4; cursor: default; }
.lb-empty { text-align: center; color: var(--text-3); padding: 44px 12px; }
.lb-empty .material-symbols-outlined { font-size: 40px; color: var(--divider); display: block; margin: 0 auto 10px; }

/* ─── Impersonation: edit mode (admin) turns the strip RED to signal full power ─── */
.impersonation.edit { background: var(--red-soft); color: #9a2b22; border-bottom-color: #f3b6b0; }
.impersonation.edit .vo-badge { color: #a52714; border-color: #e59a92; }
.impersonation.edit button#impersonation-back,
.impersonation.edit button#impersonation-stop { border-color: #e0a49c; color: #9a2b22; }
.impersonation.edit button#impersonation-back:hover,
.impersonation.edit button#impersonation-stop:hover { background: #fdeeec; }
.imp-mode {
  border: 1px solid currentColor; background: transparent; cursor: pointer;
  border-radius: 16px; padding: 4px 14px; font-size: 12.5px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px;
}
.impersonation button.imp-mode { color: #7a4d05; border-color: #d9b25f; }
.impersonation button.imp-mode:hover { background: #fff8ea; }
.impersonation.edit button.imp-mode { color: #9a2b22; border-color: #e0a49c; }
.impersonation.edit button.imp-mode:hover { background: #fdeeec; }
.imp-mode .material-symbols-outlined { font-size: 16px; }
/* in edit mode, actions are LIVE — undo the view-only dimming */
body.editing .main .btn.primary, body.editing .main .btn.danger, body.editing .main [data-viewas] { opacity: 1; pointer-events: auto; }

/* ─── Organization tree (collapsible, searchable) ─── */
.orgtree { margin-top: 4px; }
.orgrow { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 8px; cursor: default; }
.orgrow:hover { background: #f8f9fa; }
.orgtwist { border: 0; background: none; cursor: pointer; color: var(--text-2); width: 24px; height: 24px; display: grid; place-items: center; flex: none; border-radius: 6px; }
.orgtwist:hover { background: #e8eaed; }
.orgtwist .material-symbols-outlined { font-size: 20px; }
.orgicon { color: var(--text-3); font-size: 20px; flex: none; }
.orgname { font-weight: 500; font-size: 13.5px; white-space: nowrap; }
.orgmeta { color: var(--text-3); font-size: 12px; margin-left: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.orgview { margin-left: auto; flex: none; }
.orgrow:not(:hover) .orgview { visibility: hidden; }
