/* Sales Hunter user management + shell chooser — Stitch "Light & Gold".
   Tokens: --sh-* from theme.css (fallbacks declared for standalone shell pages). */

body.pm-shell-page, #sec-users, #sec-chooser {
  --sh-primary: #855300; --sh-primary-container: #f59e0b; --sh-on-primary-container: #613b00;
  --sh-surface: #f8f9ff; --sh-surface-lowest: #ffffff; --sh-surface-low: #eff4ff; --sh-surface-container: #e5eeff;
  --sh-surface-high: #dce9ff; --sh-on-surface: #0b1c30; --sh-on-surface-variant: #534434;
  --sh-outline: #867461; --sh-outline-variant: #d8c3ad; --sh-error: #ba1a1a; --sh-error-container: #ffdad6;
  --sh-ok: #067647; --sh-ok-bg: #ecfdf3;
  --sh-shadow: 0 1px 8px rgba(11,28,48,.05); --sh-shadow-lg: 0 8px 28px rgba(11,28,48,.10);
  --sh-font: 'Plus Jakarta Sans', system-ui, sans-serif;
}

#sec-users, #sec-chooser { color: var(--sh-on-surface); font-family: var(--sh-font); }
#sec-users .material-symbols-outlined, #sec-chooser .material-symbols-outlined,
body.pm-shell-page .material-symbols-outlined { font-size: 18px; line-height: 1; vertical-align: middle; }
body.pm-lock-admin [data-needs-shell="admin"],
body.pm-chooser-on [data-needs-shell="admin"] { display: none !important; }
#pmShellNav[hidden] { display: none !important; }
#pmShellNav .nav-item { cursor: pointer; width: calc(100% - 8px); }

.ws-switcher { display: inline-flex; background: var(--sh-surface-low); border-radius: 999px; padding: 3px; gap: 2px; }
.ws-switcher button {
  border: none; background: transparent; color: var(--sh-on-surface-variant);
  font-size: 12px; font-weight: 700; padding: 6px 12px; border-radius: 999px; cursor: pointer; font-family: inherit;
}
.ws-switcher button.active { background: var(--sh-primary-container); color: var(--sh-on-primary-container); box-shadow: var(--sh-shadow); }

/* Top strip (sub-pages, chooser, shell pages) */
.pm-top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px;
  background: var(--sh-surface-lowest); border-radius: 12px; padding: 14px 18px; box-shadow: var(--sh-shadow);
}
.pm-kicker { font-size: 11px; font-weight: 700; color: var(--sh-primary); text-transform: uppercase; letter-spacing: .08em; }
.pm-kicker-sub { font-size: 13px; font-weight: 600; color: var(--sh-on-surface); margin-top: 2px; }
.pm-kicker-sub a { color: var(--sh-on-surface-variant); text-decoration: none; display: inline-flex; align-items: center; gap: 2px; }
.pm-kicker-sub a:hover { color: var(--sh-primary); }
.pm-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--sh-on-surface-variant); }
.pm-api {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; font-weight: 700;
  background: #ffddb8; color: #2a1700; border-radius: 6px; padding: 3px 8px;
}

.pm-hdr { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.pm-crumbs { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--sh-on-surface-variant); }
.pm-crumb-main { display: inline-flex; align-items: center; gap: 4px; color: var(--sh-primary); }
.pm-crumb-chip { background: var(--sh-surface-high); color: var(--sh-on-surface); padding: 3px 8px; border-radius: 6px; font-family: ui-monospace, Menlo, monospace; text-transform: none; letter-spacing: 0; }
.pm-title { font-size: 30px; font-weight: 800; color: var(--sh-on-surface); line-height: 1.2; letter-spacing: -.02em; }
.pm-sub { font-size: 14px; color: var(--sh-on-surface-variant); margin-top: 6px; max-width: 760px; line-height: 1.55; }
.pm-sub-tight { margin: -2px 0 12px; font-size: 13px; }

.pm-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 18px; border-radius: 8px;
  font-size: 13px; font-weight: 700; cursor: pointer; border: none; font-family: inherit; min-height: 38px; text-decoration: none;
  transition: background .15s, transform .1s;
}
.pm-btn:active:not(:disabled) { transform: scale(.97); }
.pm-btn:disabled { opacity: .6; cursor: not-allowed; }
.pm-btn-gold { background: var(--sh-primary-container); color: var(--sh-on-primary-container); box-shadow: var(--sh-shadow); }
.pm-btn-gold:hover:not(:disabled) { background: #fe932c; }
.pm-btn-ghost { background: var(--sh-surface-low); color: var(--sh-on-surface); }
.pm-btn-ghost:hover { background: var(--sh-surface-high); }
.pm-btn-secondary { background: var(--sh-surface-container); color: var(--sh-on-surface); }
.pm-btn-secondary:hover { background: var(--sh-surface-high); }
.pm-btn-sm { padding: 6px 12px; font-size: 12px; min-height: 32px; }
.pm-btn-sm .material-symbols-outlined { font-size: 16px !important; }

/* KPI cards */
.pm-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.pm-kpi { display: flex; gap: 14px; align-items: center; background: var(--sh-surface-lowest); border-radius: 12px; padding: 16px 18px; box-shadow: var(--sh-shadow); }
.pm-kpi-ico { width: 44px; height: 44px; border-radius: 12px; background: #ffddb8; color: var(--sh-primary); display: flex; align-items: center; justify-content: center; font-size: 22px !important; flex-shrink: 0; }
.pm-kpi-lbl { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--sh-on-surface-variant); }
.pm-kpi-val { font-size: 26px; font-weight: 800; line-height: 1.15; color: var(--sh-on-surface); }
.pm-kpi-sub { font-size: 12px; color: var(--sh-on-surface-variant); }

/* Filters strip */
.pm-filters {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  background: var(--sh-surface-lowest); border-radius: 12px; padding: 12px 16px; box-shadow: var(--sh-shadow); margin-bottom: 24px;
}
.pm-tabs { display: inline-flex; gap: 2px; background: var(--sh-surface-low); padding: 4px; border-radius: 10px; flex-wrap: wrap; }
.pm-tab {
  border: none; background: transparent; color: var(--sh-on-surface-variant); border-radius: 8px; padding: 8px 14px;
  font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit; display: inline-flex; align-items: center; gap: 8px;
}
.pm-tab:hover { color: var(--sh-on-surface); }
.pm-tab.active { background: var(--sh-surface-lowest); color: var(--sh-on-surface); font-weight: 800; box-shadow: var(--sh-shadow); }
.pm-tab .count { background: var(--sh-surface-container); color: var(--sh-on-surface-variant); border-radius: 999px; padding: 0 8px; font-size: 11px; line-height: 18px; font-weight: 700; margin: 0; }
.pm-tab.active .count { background: var(--sh-primary-container); color: var(--sh-on-primary-container); }
.pm-toolbar { display: flex; align-items: center; gap: 10px; flex: 1; justify-content: flex-end; min-width: 240px; flex-wrap: wrap; }
.pm-search { position: relative; display: flex; align-items: center; flex: 1; min-width: 200px; max-width: 420px; }
.pm-search .material-symbols-outlined { position: absolute; left: 12px; color: var(--sh-on-surface-variant); pointer-events: none; }
.pm-search input {
  width: 100%; border: 1px solid transparent; outline: none; background: var(--sh-surface-low); border-radius: 8px;
  padding: 9px 12px 9px 38px; font-size: 13px; font-family: inherit; color: var(--sh-on-surface);
}
.pm-search input:focus { background: var(--sh-surface-lowest); border-color: var(--sh-primary-container); box-shadow: 0 0 0 3px rgba(245,158,11,.2); }
.pm-filter-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--sh-surface-low); color: var(--sh-on-surface-variant); padding: 8px 12px; border-radius: 8px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.pm-filter-chip strong { color: var(--sh-on-surface); }
.pm-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pm-filter-chip .pm-dot { background: var(--sh-primary-container); }

/* Cards + registry table */
.pm-card { background: var(--sh-surface-lowest); border-radius: 12px; box-shadow: var(--sh-shadow); }
.pm-reg { overflow: hidden; margin-bottom: 8px; }
.pm-table-wrap { overflow-x: auto; }
.pm-table { width: 100%; border-collapse: collapse; }
.pm-table th {
  text-align: left; font-size: 11px; font-weight: 700; color: var(--sh-on-surface-variant); letter-spacing: .06em;
  text-transform: uppercase; padding: 12px 18px; background: var(--sh-surface-low); white-space: nowrap;
}
.pm-th-act, .pm-td-act { text-align: right !important; white-space: nowrap; }
.pm-table td { padding: 14px 18px; font-size: 13px; color: var(--sh-on-surface); border-bottom: 1px solid var(--sh-surface-low); vertical-align: middle; }
.pm-table tr:last-child td { border-bottom: none; }
.pm-table tbody tr:hover td { background: var(--sh-surface); }
.pm-src { color: var(--sh-on-surface-variant); font-size: 12px; }
.pm-none { color: var(--sh-on-surface-variant); font-size: 12px; font-style: italic; opacity: .8; }
.pm-empty { text-align: center; padding: 36px 16px !important; color: var(--sh-on-surface-variant); }
.pm-empty .material-symbols-outlined { font-size: 32px !important; display: block; margin: 0 auto 6px; opacity: .5; }

.pm-ident { display: flex; align-items: center; gap: 12px; min-width: 0; }
.pm-avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--sh-surface-container); color: var(--sh-on-surface);
  display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; flex-shrink: 0;
}
.pm-avatar.pending { background: #ffddb8; color: #2a1700; box-shadow: 0 0 0 2px var(--sh-primary-container); }
.pm-ident-text { display: flex; flex-direction: column; min-width: 0; }
.pm-ident-text strong { font-weight: 700; color: var(--sh-on-surface); }
.pm-ident-text span { font-size: 11px; color: var(--sh-on-surface-variant); font-family: ui-monospace, Menlo, monospace; overflow: hidden; text-overflow: ellipsis; }

/* Pills + module chips */
.pm-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 6px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.pm-pill .pm-dot { width: 6px; height: 6px; }
.pm-pill-pending { background: #ffddb8; color: #2a1700; }
.pm-pill-invited { background: var(--sh-surface-container); color: #3f465c; }
.pm-pill-rejected { background: var(--sh-error-container); color: #93000a; }
.pm-pill-active { background: var(--sh-ok-bg); color: var(--sh-ok); }
.pm-mod { display: inline-flex; align-items: center; gap: 4px; margin: 0 4px 4px 0; padding: 3px 10px 3px 6px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.pm-mod .material-symbols-outlined { font-size: 14px !important; }
.pm-mod-admin { background: var(--sh-surface-high); color: var(--sh-on-surface); }
.pm-mod-business { background: #ffddb8; color: #653e00; }
.pm-mod-agent { background: var(--sh-ok-bg); color: var(--sh-ok); }
.pm-path { font-size: 10px; color: var(--sh-on-surface-variant); font-weight: 600; }

.pm-banner {
  background: #ffddb8; color: #2a1700; border-radius: 12px; padding: 12px 16px; font-size: 13px; line-height: 1.5; margin-bottom: 16px;
  border-left: 4px solid var(--sh-primary-container);
}
.pm-banner strong { color: #2a1700; }

/* Forms (invite / approve / edit) */
.pm-form { padding: 22px 24px 20px; max-width: 760px; }
.pm-field { margin-bottom: 16px; }
.pm-lbl { display: block; font-size: 11px; font-weight: 700; color: var(--sh-on-surface-variant); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.pm-req { color: var(--sh-error); }
.pm-form input[type="text"], .pm-form input[type="email"], .pm-form input[type="search"], .pm-form select, .pm-form textarea {
  width: 100%; padding: 10px 12px; border: 1px solid transparent; border-radius: 8px; font-size: 14px; color: var(--sh-on-surface);
  background: var(--sh-surface-low); font-family: inherit; outline: none; box-sizing: border-box;
}
.pm-form input:focus, .pm-form select:focus, .pm-form textarea:focus {
  background: var(--sh-surface-lowest); border-color: var(--sh-primary-container); box-shadow: 0 0 0 3px rgba(245,158,11,.2);
}
.pm-form input:disabled { background: var(--sh-surface-container); color: var(--sh-on-surface-variant); }
.pm-hint { font-size: 12px; color: var(--sh-on-surface-variant); margin-top: 6px; line-height: 1.5; }
.pm-hint code, .pm-claim code { font-size: 11px; }

.pm-box { border-radius: 12px; padding: 14px; background: var(--sh-surface); border: 1px solid var(--sh-surface-container); }
.pm-box-title { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--sh-on-surface-variant); margin-bottom: 12px; }
.pm-check {
  display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--sh-surface-container); background: var(--sh-surface-lowest);
  border-radius: 10px; padding: 14px; margin-bottom: 8px; cursor: pointer; transition: border-color .15s, background .15s;
}
.pm-check:hover { border-color: var(--sh-outline-variant); }
.pm-check.checked { border-color: var(--sh-primary-container); background: #fff8ef; box-shadow: inset 0 0 0 1px var(--sh-primary-container); }
.pm-check input { margin-top: 3px; accent-color: var(--sh-primary-container); width: 16px; height: 16px; }
.pm-mod-name { font-weight: 700; color: var(--sh-on-surface); font-size: 14px; }
.pm-mod-desc { font-size: 12px; color: var(--sh-on-surface-variant); margin-top: 2px; line-height: 1.45; }
.pm-mod-claim {
  display: inline-block; margin-top: 6px; font-size: 11px; color: var(--sh-on-surface-variant); background: var(--sh-surface-low);
  border-radius: 6px; padding: 2px 6px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.pm-tenant { border: 1px dashed var(--sh-primary-container); background: #fff8ef; border-radius: 10px; padding: 14px; margin: 4px 0 8px; }
.pm-tenant-title { font-size: 13px; font-weight: 700; color: var(--sh-primary); margin-bottom: 8px; }
.pm-lead { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: 10px; background: var(--sh-surface-lowest); border: 1px solid var(--sh-surface-container); margin-top: 4px; }
.pm-lead[hidden], .pm-tenant[hidden] { display: none; }
.pm-lead-lbl { font-size: 13px; font-weight: 700; color: var(--sh-on-surface); }
.pm-lead-hint { font-size: 11px; color: var(--sh-on-surface-variant); margin-top: 2px; }
.pm-lead input[type="checkbox"] { accent-color: var(--sh-primary-container); width: 18px; height: 18px; flex-shrink: 0; }

.pm-claim {
  margin-top: 14px; background: var(--sh-on-surface); color: #eaf1ff; border-radius: 10px; padding: 14px 16px; font-size: 12px;
  line-height: 1.5; overflow-x: auto; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap;
}
.pm-claim .ck { color: var(--sh-primary-container); display: block; margin-bottom: 6px; }

.pm-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.pm-error { color: var(--sh-error); font-size: 12px; font-weight: 700; margin-top: 8px; }
.pm-error[hidden] { display: none; }

.pm-pending { display: flex; justify-content: space-between; gap: 12px; padding: 18px 20px; margin-bottom: 16px; align-items: flex-start; max-width: 760px; }
.pm-pending h3 { margin: 0 0 4px; font-size: 16px; font-weight: 800; }
.pm-pending p { margin: 0; font-size: 13px; color: var(--sh-on-surface-variant); line-height: 1.5; }

.pm-section-title { font-size: 12px; font-weight: 800; margin: 24px 0 10px; color: var(--sh-on-surface); text-transform: uppercase; letter-spacing: .08em; }

.pm-chooser { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.pm-choice { padding: 20px; }
.pm-choice h3 { margin: 12px 0 6px; font-size: 16px; font-weight: 800; }
.pm-choice p { margin: 0 0 14px; font-size: 13px; color: var(--sh-on-surface-variant); line-height: 1.5; }
.pm-ico { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-weight: 800; color: var(--sh-on-surface); }
.pm-ico-admin { background: var(--sh-surface-high); }
.pm-ico-business { background: #ffddb8; color: #653e00; }
.pm-ico-agent { background: var(--sh-ok-bg); color: var(--sh-ok); }
.pm-choice-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.pm-inline { display: flex; gap: 8px; align-items: center; }
.pm-inline input { flex: 1; }

@media (max-width: 860px) {
  .pm-title { font-size: 24px; }
  .pm-filters { padding: 12px; }
  .pm-toolbar { justify-content: stretch; }
  .pm-filter-chip { display: none; }
  .pm-hdr > .pm-btn { width: 100%; }
  .pm-form { padding: 16px; }
  .pm-table th, .pm-table td { padding: 12px; }
  .pm-top { flex-direction: column; align-items: flex-start; }
}

/* Standalone business / agent shell pages */
body.pm-shell-page {
  margin: 0;
  min-height: 100vh;
  background: var(--sh-surface);
  color: var(--sh-on-surface);
  font-family: var(--sh-font);
}
body.pm-shell-page #pmShell { display: flex; min-height: 100vh; }
body.pm-shell-page .pm-side {
  width: 260px;
  flex-shrink: 0;
  background: linear-gradient(180deg, #111827 0%, #172033 58%, #101828 100%);
  color: #F9FAFB;
  display: flex;
  flex-direction: column;
}
body.pm-shell-page .pm-side-brand { display: flex; gap: 10px; align-items: center; padding: 22px 18px 16px; }
body.pm-shell-page .pm-mark {
  width: 42px; height: 42px; border-radius: 8px; background: #F5B700; color: #101828;
  display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 12px;
}
body.pm-shell-page .pm-side nav { padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; }
body.pm-shell-page .pm-side button,
body.pm-shell-page .pm-side a.pm-nav {
  display: flex; align-items: center; gap: 8px;
  width: 100%; text-align: left; border: none; cursor: pointer;
  background: transparent; color: #D0D5DD; border-radius: 8px;
  padding: 10px 12px; font-size: 13px; font-weight: 700; font-family: inherit;
  text-decoration: none;
}
body.pm-shell-page .pm-side button.active,
body.pm-shell-page .pm-side a.pm-nav.active { background: #F5B700; color: #101828; }
body.pm-shell-page .pm-side-foot { margin-top: auto; padding: 14px 16px 18px; font-size: 12px; color: #98A2B3; }
body.pm-shell-page .pm-main { flex: 1; min-width: 0; padding: 24px 30px 36px; }
body.pm-shell-page .pm-rows { width: 100%; border-collapse: collapse; }
body.pm-shell-page .pm-rows th, body.pm-shell-page .pm-rows td {
  text-align: left; padding: 10px 12px; border-bottom: 1px solid #EEF2F7; font-size: 13px;
}
body.pm-shell-page .pm-rows th { font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: #667085; }
