/* PGJ Leads. Neutrals and the blue/orange pair come from the validated data-viz palette; light and dark are both selected, not inverted. */
:root {
  color-scheme: light;
  --bg: #f9f9f7; --surface: #fcfcfb; --raised: #ffffff;
  --ink: #0b0b0b; --ink2: #52514e; --mute: #898781;
  --line: #e1e0d9; --axis: #c3c2b7; --border: rgba(11,11,11,.10); --wash: rgba(11,11,11,.045);
  --accent: #2a78d6; --accent-ink: #1c5cab; --accent-wash: rgba(42,120,214,.10);
  --s2: #eb6834;
  --good: #0ca30c; --good-ink: #006300; --warn: #fab219; --crit: #d03b3b;
  --st-new: #2a78d6; --st-contacted: #6250d6; --st-progress: #eb6834; --st-won: #0ca30c; --st-lost: #898781;
  --shadow: 0 1px 2px rgba(11,11,11,.05), 0 8px 28px rgba(11,11,11,.08);
  --r: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg: #0d0d0d; --surface: #1a1a19; --raised: #222220;
    --ink: #f0efec; --ink2: #c3c2b7; --mute: #898781;
    --line: #2c2c2a; --axis: #383835; --border: rgba(255,255,255,.10); --wash: rgba(255,255,255,.05);
    --accent: #3987e5; --accent-ink: #86b6ef; --accent-wash: rgba(57,135,229,.16);
    --s2: #d95926; --good-ink: #0ca30c;
    --st-new: #3987e5; --st-contacted: #9085e9; --st-progress: #d95926;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 28px rgba(0,0,0,.5);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d0d0d; --surface: #1a1a19; --raised: #222220;
  --ink: #f0efec; --ink2: #c3c2b7; --mute: #898781;
  --line: #2c2c2a; --axis: #383835; --border: rgba(255,255,255,.10); --wash: rgba(255,255,255,.05);
  --accent: #3987e5; --accent-ink: #86b6ef; --accent-wash: rgba(57,135,229,.16);
  --s2: #d95926; --good-ink: #0ca30c;
  --st-new: #3987e5; --st-contacted: #9085e9; --st-progress: #d95926;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 28px rgba(0,0,0,.5);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; min-height: 100vh; }
a { color: var(--accent-ink); text-decoration: none; } a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.mono { font-family: var(--mono); font-size: 12px; }
.mute { color: var(--mute); } .ink2 { color: var(--ink2); }

/* buttons + inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); font-weight: 500; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--wash); text-decoration: none; }
.btn-primary { background: var(--ink); color: var(--bg); border-color: var(--ink); } .btn-primary:hover { background: var(--ink); opacity: .86; }
.btn-wa { background: #1f9d55; border-color: #1f9d55; color: #fff; } .btn-wa:hover { background: #1a8a4a; }
.btn-danger { color: var(--crit); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.icon-btn { width: 34px; padding: 0; }
.input, .select, .textarea { height: 34px; width: 100%; padding: 0 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); }
.textarea { height: auto; min-height: 76px; padding: 8px 10px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
.select { padding-right: 24px; }
.field { display: grid; gap: 4px; } .field > span { font-size: 12px; color: var(--ink2); font-weight: 500; }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; }

/* shell */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 18px; padding: 0 20px; height: 54px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 650; letter-spacing: -.01em; color: var(--ink); } .brand:hover { text-decoration: none; }
.brand-mark { width: 26px; height: 26px; border-radius: 7px; background: var(--ink); color: var(--bg); display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.tabs { display: flex; gap: 2px; margin-left: 6px; overflow-x: auto; scrollbar-width: none; } .tabs::-webkit-scrollbar { display: none; }
.tab { position: relative; display: inline-flex; align-items: center; gap: 7px; height: 54px; padding: 0 12px; color: var(--ink2); font-weight: 500; white-space: nowrap; border-bottom: 2px solid transparent; }
.tab:hover { color: var(--ink); text-decoration: none; } .tab.is-on { color: var(--ink); border-bottom-color: var(--ink); }
.badge { min-width: 19px; height: 19px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 650; display: inline-grid; place-items: center; }
.top-r { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.who { font-size: 13px; color: var(--ink2); text-align: right; line-height: 1.2; } .who b { color: var(--ink); display: block; font-weight: 600; }
.page { max-width: 1440px; margin: 0 auto; padding: 18px 20px 60px; }
.page-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head h1 { margin: 0; font-size: 20px; letter-spacing: -.015em; }
.banner { display: flex; align-items: center; gap: 10px; padding: 10px 14px; margin-bottom: 14px; border-radius: var(--r); background: var(--accent-wash); border: 1px solid var(--accent); color: var(--ink); }
.banner button { margin-left: auto; }

/* filters */
.filters { display: grid; gap: 10px; margin-bottom: 14px; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.frow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.search { position: relative; flex: 1 1 260px; min-width: 200px; } .search .input { padding-left: 32px; } .search svg { position: absolute; left: 10px; top: 9px; width: 16px; height: 16px; color: var(--mute); pointer-events: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-size: 13px; color: var(--ink2); }
.chip:hover { background: var(--wash); } .chip.is-on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip small { font-size: 11px; opacity: .72; font-variant-numeric: tabular-nums; }
.flabel { font-size: 12px; color: var(--mute); font-weight: 500; min-width: 54px; }
.seg { display: inline-flex; max-width: 100%; overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); scrollbar-width: none; }
.seg button { border: 0; background: transparent; height: 30px; padding: 0 12px; white-space: nowrap; color: var(--ink2); font-size: 13px; border-right: 1px solid var(--border); } .seg button:last-child { border-right: 0; }
.seg button:hover { background: var(--wash); } .seg button.is-on { background: var(--ink); color: var(--bg); }

/* table */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; font-weight: 600; color: var(--mute); padding: 9px 9px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface); position: sticky; top: 0; }
.tbl td { padding: 10px 9px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr { cursor: pointer; } .tbl tbody tr:hover { background: var(--wash); } .tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tr.is-new td:nth-child(3) .nm { font-weight: 650; }
.tbl tr.is-sel { background: var(--accent-wash); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .nm { color: var(--ink); } .tbl .sub { color: var(--mute); font-size: 12px; }
.tbl .sum { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink2); }
.tbl .when { white-space: nowrap; } .tbl .when b { font-weight: 550; display: block; } .tbl .when span { color: var(--mute); font-size: 12px; }
.star { border: 0; background: transparent; padding: 2px; color: var(--axis); line-height: 0; } .star.is-on { color: #e8a317; } .star svg { width: 16px; height: 16px; }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; background: var(--wash); color: var(--ink2); font-size: 12px; font-weight: 500; white-space: nowrap; }
.store { font-size: 11px; font-weight: 650; letter-spacing: .04em; padding: 2px 6px; border-radius: 5px; border: 1px solid var(--border); color: var(--ink2); }
.st { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; font-weight: 500; }
.st i { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--mute)); flex: none; } .st.is-hollow i { background: transparent; box-shadow: inset 0 0 0 2px var(--c); }
.st-select { height: 28px; font-size: 13px; padding: 0 22px 0 8px; width: auto; min-width: 118px; }
.who-chip { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-wash); color: var(--accent-ink); font-size: 11px; font-weight: 650; }
.show-m { display: none; }
.fold { display: grid; gap: 10px; }
.tbl .nm .store { margin-left: 6px; }
.pager { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--line); color: var(--ink2); font-size: 13px; }
.pager .sp { margin-left: auto; display: flex; gap: 6px; }
.bulk { display: flex; align-items: center; gap: 8px; padding: 9px 14px; border-bottom: 1px solid var(--line); background: var(--accent-wash); flex-wrap: wrap; }
.empty { padding: 56px 20px; text-align: center; color: var(--mute); } .empty b { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }
.dim { opacity: .55; transition: opacity .15s; }

/* drawer */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.34); z-index: 40; animation: fade .16s; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 100%); z-index: 41; background: var(--bg); border-left: 1px solid var(--line); box-shadow: var(--shadow); display: flex; flex-direction: column; animation: slide .18s ease-out; }
.d-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.d-head .ttl { flex: 1; min-width: 0; } .d-head .ttl b { display: block; font-size: 15px; } .d-head .ttl span { font-size: 12px; color: var(--mute); }
.d-body { flex: 1; overflow-y: auto; padding: 16px; display: grid; gap: 14px; align-content: start; }
.sec { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
.sec h3 { margin: 0 0 10px; font-size: 12px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--mute); }
.who-line { display: flex; align-items: center; gap: 12px; }
.avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--accent-wash); color: var(--accent-ink); display: grid; place-items: center; font-weight: 650; flex: none; }
.who-line .nm { font-size: 17px; font-weight: 650; letter-spacing: -.01em; }
.contacts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.actions .full { grid-column: 1 / -1; }
dl.kv { display: grid; grid-template-columns: minmax(110px, 34%) 1fr; gap: 8px 14px; margin: 0; }
dl.kv dt { color: var(--mute); font-size: 13px; } dl.kv dd { margin: 0; word-break: break-word; }
dl.kv dd ul { margin: 0; padding-left: 16px; } dl.kv dd .pill { display: inline-block; margin: 0 4px 4px 0; padding: 1px 8px; border-radius: 999px; background: var(--wash); font-size: 12.5px; }
dl.kv dd .sub-kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: 13px; } dl.kv dd .sub-kv b { font-weight: 500; color: var(--mute); }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.photos a { display: block; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: var(--wash); line-height: 0; }
.photos img { width: 100%; aspect-ratio: 1; object-fit: cover; transition: transform .15s; } .photos a:hover img { transform: scale(1.04); }
.sched { display: flex; align-items: center; gap: 12px; } .sched .big { font-size: 18px; font-weight: 650; letter-spacing: -.01em; } .sched .cd { margin-left: auto; font-size: 13px; color: var(--ink2); }
.tl { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.tl li { display: grid; grid-template-columns: 14px 1fr; gap: 10px; padding: 0 0 12px; position: relative; }
.tl li::before { content: ""; position: absolute; left: 4.5px; top: 12px; bottom: 0; width: 1px; background: var(--line); } .tl li:last-child::before { display: none; }
.tl .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--axis); margin-top: 5px; } .tl .note .dot { background: var(--accent); } .tl .status .dot { background: var(--st-contacted); }
.tl .body { white-space: pre-wrap; word-break: break-word; } .tl .meta { font-size: 12px; color: var(--mute); }
.note-box { display: grid; gap: 8px; margin-top: 6px; } .note-box .row { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 12px; color: var(--mute); }
details.raw summary { cursor: pointer; color: var(--ink2); font-size: 13px; } details.raw pre { margin: 10px 0 0; padding: 12px; background: var(--wash); border-radius: 8px; overflow: auto; max-height: 280px; font: 12px/1.5 var(--mono); }
.rel-list { display: grid; gap: 6px; } .rel { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: transparent; text-align: left; width: 100%; } .rel:hover { background: var(--wash); } .rel .sum { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* schedule */
.day { margin-bottom: 18px; } .day h2 { font-size: 13px; margin: 0 0 8px; color: var(--ink2); font-weight: 650; display: flex; gap: 8px; align-items: center; } .day h2 .today { background: var(--accent); color: #fff; padding: 1px 8px; border-radius: 999px; font-size: 11px; }
.slot { display: grid; grid-template-columns: 74px 1fr auto; gap: 14px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); cursor: pointer; text-align: left; width: 100%; background: transparent; border-left: 0; border-right: 0; border-top: 0; }
.slot:hover { background: var(--wash); } .slot:last-child { border-bottom: 0; }
.slot .t { font-size: 17px; font-weight: 650; font-variant-numeric: tabular-nums; } .slot .t small { display: block; font-size: 11px; font-weight: 500; color: var(--mute); }
.slot .nm { font-weight: 600; } .slot .sub { color: var(--ink2); font-size: 13px; }

/* stats */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 14px; }
.tile { padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.tile .lbl { color: var(--ink2); font-size: 13px; } .tile .val { font-size: 30px; font-weight: 650; letter-spacing: -.02em; line-height: 1.15; margin: 4px 0 2px; } .tile .val small { font-size: 14px; font-weight: 500; color: var(--mute); margin-left: 3px; }
.tile .note { font-size: 12px; color: var(--mute); } .tile.warn { border-color: var(--warn); } .tile.warn .note { color: var(--ink2); }
.charts { display: grid; grid-template-columns: repeat(12, 1fr); gap: 12px; }
.cc { padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); display: grid; gap: 10px; align-content: start; grid-column: span 6; min-width: 0; }
.cc.wide { grid-column: span 12; }
.cc-head { display: flex; align-items: baseline; gap: 10px; } .cc-head h2 { margin: 0; font-size: 14px; font-weight: 650; } .cc-head p { margin: 0; color: var(--mute); font-size: 12.5px; flex: 1; } .cc-head .btn { margin-left: auto; }
.viz { position: relative; } .viz svg { display: block; width: 100%; height: auto; overflow: visible; }
.viz text { font: 11.5px var(--font); fill: var(--mute); } .viz .vl { fill: var(--ink); font-weight: 600; } .viz .lb { fill: var(--ink2); font-size: 12.5px; }
.viz .grid { stroke: var(--line); stroke-width: 1; shape-rendering: crispEdges; } .viz .axis { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.viz .bar { fill: var(--accent); transition: opacity .12s; } .viz .bar.is-dim { opacity: .45; } .viz .hit { fill: transparent; cursor: default; } .viz .hit:focus { outline: none; } .viz .hit:focus-visible + .ring, .viz .hit:hover + .ring { opacity: 1; }
.viz .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; } .viz .area { fill: var(--accent); opacity: .10; }
.viz .dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; } .viz .cross { stroke: var(--axis); stroke-width: 1; }
.viz .seg1 { fill: var(--accent); } .viz .seg2 { fill: var(--s2); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--ink2); } .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; } .legend b { color: var(--ink); font-weight: 650; margin-left: 4px; }
.tip { position: absolute; z-index: 5; pointer-events: none; min-width: 120px; padding: 8px 10px; border-radius: 8px; background: var(--raised); border: 1px solid var(--border); box-shadow: var(--shadow); font-size: 12.5px; transform: translate(-50%, calc(-100% - 10px)); white-space: nowrap; }
.tip b { display: block; font-size: 15px; font-weight: 650; color: var(--ink); } .tip span { color: var(--ink2); }
table.mini { width: 100%; border-collapse: collapse; font-size: 13px; } .mini th { text-align: left; color: var(--mute); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line); } .mini td { padding: 6px 8px; border-bottom: 1px solid var(--line); } .mini td:last-child, .mini th:last-child { text-align: right; font-variant-numeric: tabular-nums; }

/* team / login / misc */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login { width: 360px; max-width: 100%; padding: 28px; display: grid; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.login h1 { margin: 0; font-size: 20px; letter-spacing: -.015em; } .login p { margin: 0; color: var(--ink2); }
.err { color: var(--crit); font-size: 13px; min-height: 18px; }
.team-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; align-items: end; padding: 14px; border-bottom: 1px solid var(--line); }
.toasts { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 80; }
.toast { padding: 10px 16px; border-radius: 10px; background: var(--ink); color: var(--bg); box-shadow: var(--shadow); animation: rise .18s ease-out; max-width: 90vw; } .toast.bad { background: var(--crit); color: #fff; }
dialog { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); padding: 22px; width: 400px; max-width: calc(100% - 24px); box-shadow: var(--shadow); } dialog::backdrop { background: rgba(0,0,0,.4); }
dialog h3 { margin: 0 0 6px; font-size: 16px; } dialog p { margin: 0 0 14px; color: var(--ink2); } dialog .row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
@keyframes fade { from { opacity: 0; } } @keyframes slide { from { transform: translateX(28px); opacity: .4; } } @keyframes rise { from { transform: translateY(8px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

@media (max-width: 900px) {
  .page { padding: 12px 12px 60px; } .topbar { padding: 0 10px; gap: 8px; } .who { display: none; }
  .cc { grid-column: span 12; } .slot { grid-template-columns: 60px 1fr; } .slot > :last-child { grid-column: 2; }
  .actions { grid-template-columns: 1fr; } dl.kv { grid-template-columns: 1fr; gap: 2px; } dl.kv dd { margin-bottom: 8px; }
  .hide-m { display: none !important; } .show-m { display: inline-flex; }
  .fold:not(.open) { display: none; }
  .kpis { grid-template-columns: repeat(2, 1fr); gap: 8px; } .tile { padding: 12px; } .tile .val { font-size: 24px; }
  .tab { padding: 0 9px; } .top-r { gap: 6px; } .search { flex-basis: 100%; }
  .tbl .when span { display: none; }
  .tbl th, .tbl td { padding: 10px 6px; } .tbl .when b { font-size: 12.5px; } .tbl .sub { font-size: 11.5px; }
  .st-select { min-width: 0; width: 104px; padding-right: 18px; text-overflow: ellipsis; }
}
@media print { .topbar, .filters, .pager, .drawer, .scrim { display: none !important; } }
