/* ==========================================================================
   Org Chart Viewer — Professional theme (Stripe-inspired)
   ========================================================================== */

:root {
    --color-bg: #f7f8fa;
    --color-surface: #ffffff;
    --color-border: #e3e8ee;
    --color-border-light: #f0f2f5;
    --color-text: #1a1f36;
    --color-text-secondary: #5a6072;
    --color-text-muted: #8792a2;
    --color-primary: #0a2540;
    --color-primary-light: #425466;
    --color-accent: #0073e6;
    --color-accent-light: #e8f4fd;
    --color-accent-hover: #005bb5;
    --color-highlight: #fff8e1;
    --color-tag-bg: #f0f2f5;
    --radius: 8px;
    --radius-sm: 4px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --transition: 150ms ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font);
    background: var(--color-bg);
    color: var(--color-text);
    font-size: 14px;
    line-height: 1.5;
}

.login-body {
    min-height: 100vh;
    background:
        radial-gradient(circle at top right, rgba(0, 115, 230, 0.18), transparent 32%),
        linear-gradient(135deg, #0a2540 0%, #16325c 48%, #eef3f8 48%, #f7f8fa 100%);
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-card {
    width: min(460px, 100%);
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(227, 232, 238, 0.9);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    padding: 36px;
}

.login-card-wide {
    width: min(720px, 100%);
}

.login-kicker {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-accent);
    margin-bottom: 12px;
}

.login-title {
    font-size: 30px;
    line-height: 1.1;
    letter-spacing: -0.03em;
    margin-bottom: 14px;
}

.login-copy {
    color: var(--color-text-secondary);
    margin-bottom: 24px;
}

.login-alert {
    border: 1px solid #fecaca;
    background: #fff1f2;
    color: #9f1239;
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 16px;
}

.login-google-btn {
    width: 100%;
    justify-content: center;
    padding: 11px 16px;
    background: var(--color-primary);
    color: #fff;
    text-decoration: none;
}

.login-google-btn:hover {
    background: #16325c;
}

.impersonation-list {
    display: grid;
    gap: 14px;
}

.impersonation-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px;
    border: 1px solid var(--color-border);
    border-radius: 14px;
    background: #fff;
}

.impersonation-title {
    font-size: 18px;
    margin-bottom: 4px;
}

.impersonation-meta {
    color: var(--color-text-secondary);
    font-size: 13px;
}

.login-footer-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 18px;
}

.login-footer-actions-end {
    justify-content: flex-end;
}

.auth-form {
    display: grid;
    gap: 20px;
}

.auth-section {
    display: grid;
    gap: 14px;
}

.auth-section-title {
    font-size: 18px;
}

.auth-section-copy {
    color: var(--color-text-secondary);
    margin-top: -4px;
}

.auth-grid {
    display: grid;
    gap: 14px;
}

.auth-grid-two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.auth-field {
    display: grid;
    gap: 8px;
}

.auth-field span {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-secondary);
}

.auth-field input {
    width: 100%;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 11px 12px;
    font: inherit;
    background: #fff;
    color: var(--color-text);
}

.auth-field input[readonly] {
    background: #f7f8fa;
    color: var(--color-text-secondary);
}

.auth-summary {
    border: 1px solid var(--color-border);
    border-radius: 14px;
    background: #f8fbff;
    padding: 16px 18px;
}

.auth-summary p {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-accent);
    margin-bottom: 10px;
}

.auth-summary-plain {
    background: #fff;
}

.auth-summary-list {
    padding-left: 18px;
    color: var(--color-text-secondary);
    display: grid;
    gap: 8px;
}

.auth-submit-btn {
    width: auto;
}

.login-alert-neutral {
    border-color: #bfdbfe;
    background: #eff6ff;
    color: #1d4ed8;
}

/* Header
   ========================================================================== */

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: var(--color-primary);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: baseline;
    gap: 16px;
}

.app-title {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.2px;
}

.header-stats {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
}

.header-actions {
    display: flex;
    gap: 8px;
}

@media (max-width: 640px) {
    .login-card,
    .login-card-wide {
        padding: 24px;
    }

    .auth-grid-two {
        grid-template-columns: 1fr;
    }
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-user-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.2;
}

.header-user-email {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.76);
}

.header-user-actor {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.58);
}

/* Buttons
   ========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn-outline {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-outline-light {
    background: #fff;
    color: #334155;
    border: 1.5px solid #cbd5e1;
}
.btn-outline-light:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.btn-small {
    padding: 4px 10px;
    font-size: 12px;
}

.btn-clear {
    background: transparent;
    color: var(--color-accent);
    border: 1px solid var(--color-border);
}

.btn-clear:hover {
    background: var(--color-accent-light);
}

.btn-back {
    font-weight: 600;
}

.btn-back.disabled {
    opacity: 0.35;
    pointer-events: none;
}

/* Filter bar
   ========================================================================== */

.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 54px;
    z-index: 90;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
}

.filter-input,
.filter-select {
    font-family: var(--font);
    font-size: 13px;
    padding: 7px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-bg);
    color: var(--color-text);
    transition: border-color var(--transition);
    outline: none;
}

.filter-input {
    width: 280px;
}

.filter-select {
    min-width: 160px;
    cursor: pointer;
}

.filter-input:focus,
.filter-select:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 2px var(--color-accent-light);
}

.filter-results {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-left: auto;
}

/* Main content
   ========================================================================== */

.main-content {
    display: flex;
    min-height: calc(100vh - 110px);
}

.tree-container {
    flex: 1;
    padding: 20px 24px;
    overflow-x: auto;
}

.tree-container.hidden {
    display: none;
}

/* Tree node
   ========================================================================== */

.tree-node {
    position: relative;
}

.tree-children {
    margin-left: 24px;
    border-left: 1px solid var(--color-border-light);
    padding-left: 0;
}

.tree-children.collapsed {
    display: none;
}

/* Person card (tree row)
   ========================================================================== */

.person-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    margin: 1px 0;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition);
    position: relative;
}

.person-row:hover {
    background: var(--color-accent-light);
}

.person-row.selected {
    background: var(--color-accent-light);
    box-shadow: inset 3px 0 0 var(--color-accent);
}

.person-row.highlighted {
    background: var(--color-highlight);
}

.person-row.dimmed {
    opacity: 0.35;
    cursor: pointer;
    transition: opacity 0.15s;
}
.person-row.dimmed:hover {
    opacity: 0.7;
}

.toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: none;
    background: var(--color-tag-bg);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 11px;
    color: var(--color-text-secondary);
    transition: all var(--transition);
    flex-shrink: 0;
}

.toggle-btn:hover {
    background: var(--color-border);
}

.toggle-btn.leaf {
    visibility: hidden;
}

.person-photo {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--color-tag-bg);
}

.person-info {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
}

.person-name {
    font-weight: 500;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.person-position {
    color: var(--color-text-secondary);
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.person-tags {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
    background: var(--color-tag-bg);
    color: var(--color-text-muted);
    white-space: nowrap;
}

.tag-office {
    background: #e8f5e9;
    color: #2e7d32;
}

.tag-team {
    background: #e3f2fd;
    color: #1565c0;
}

.tag-count {
    background: var(--color-primary);
    color: #fff;
    min-width: 20px;
    text-align: center;
}

/* Detail panel (sidebar)
   ========================================================================== */

.detail-panel {
    width: 360px;
    background: var(--color-surface);
    border-left: 1px solid var(--color-border);
    padding: 24px;
    overflow-y: auto;
    position: sticky;
    top: 110px;
    height: calc(100vh - 110px);
    box-shadow: var(--shadow-md);
    transition: transform 250ms ease;
}

.detail-panel.hidden {
    display: none;
}

.detail-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    border: none;
    background: var(--color-tag-bg);
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.detail-close:hover {
    background: var(--color-border);
    color: var(--color-text);
}

.btn-detail-back {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    margin-bottom: 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-bg);
    color: var(--color-text-secondary);
    font-family: var(--font);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-detail-back:hover {
    background: var(--color-accent-light);
    color: var(--color-accent);
    border-color: var(--color-accent);
}

.detail-photo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--color-tag-bg);
    margin-bottom: 16px;
}

.detail-name {
    font-size: 20px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 2px;
}

.detail-username {
    font-size: 13px;
    color: var(--color-text-muted);
    margin-bottom: 16px;
}

.detail-field {
    margin-bottom: 12px;
}

.detail-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-muted);
    margin-bottom: 2px;
}

.detail-value {
    font-size: 14px;
    color: var(--color-text);
}

.detail-value a {
    color: var(--color-accent);
    text-decoration: none;
}

.detail-value a:hover {
    text-decoration: underline;
}

.detail-section-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-muted);
    margin-top: 20px;
    margin-bottom: 8px;
    padding-top: 16px;
    border-top: 1px solid var(--color-border-light);
}

.detail-report-list {
    list-style: none;
}

.detail-report-item {
    padding: 4px 0;
    font-size: 13px;
    color: var(--color-accent);
    cursor: pointer;
}

.detail-report-item:hover {
    text-decoration: underline;
}

/* Scrollbar
   ========================================================================== */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-muted);
}

/* Loading
   ========================================================================== */

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: var(--color-text-muted);
    font-size: 14px;
}

.loading::after {
    content: "";
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-left: 8px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Tabs
   ========================================================================== */

.tab-bar {
    display: flex;
    gap: 2px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    padding: 2px;
}

.tab-btn {
    padding: 5px 14px;
    border: none;
    border-radius: 3px;
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.tab-btn:hover {
    color: #fff;
}

.tab-btn.active {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* Map view
   ========================================================================== */

.map-container {
    flex: 1;
    position: relative;
}

.map-container.hidden {
    display: none;
}

#map {
    width: 100%;
    height: calc(100vh - 110px);
}

.map-popup-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 4px;
}

.map-popup-count {
    font-size: 24px;
    font-weight: 700;
    color: var(--color-accent);
    margin-bottom: 6px;
}

.map-popup-list {
    max-height: 200px;
    overflow-y: auto;
    margin: 0;
    padding: 0;
    list-style: none;
}

.map-popup-list li {
    padding: 3px 0;
    font-size: 12px;
    color: var(--color-text-secondary);
    border-bottom: 1px solid var(--color-border-light);
}

.map-popup-list li:last-child {
    border-bottom: none;
}

.map-popup-list li strong {
    color: var(--color-text);
    font-weight: 500;
}

.map-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #fff;
    font-weight: 700;
    font-family: var(--font);
    text-align: center;
    line-height: 1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    border: 2px solid #fff;
}

.map-marker-sm {
    width: 28px;
    height: 28px;
    font-size: 11px;
    background: var(--color-accent);
}

.map-marker-md {
    width: 38px;
    height: 38px;
    font-size: 13px;
    background: #0a2540;
}

.map-marker-lg {
    width: 50px;
    height: 50px;
    font-size: 15px;
    background: #0a2540;
}

.map-marker-xl {
    width: 60px;
    height: 60px;
    font-size: 17px;
    background: #0a2540;
}

/* Power Map
   ========================================================================== */

/* ===== Internal Reach ===== */

.reach-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    height: 100%;
}

.reach-container.hidden { display: none; }
.reach-upload.hidden { display: none; }

/* Upload zone */

.reach-upload {
    flex: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 380px);
    gap: 24px;
    padding: 24px;
    overflow: auto;
    align-items: start;
    background:
        radial-gradient(circle at top left, rgba(0, 115, 230, 0.08), transparent 32%),
        linear-gradient(180deg, #fbfcfe 0%, #f3f6fa 100%);
}

.saved-entry-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    font-size: 12px;
    color: var(--color-text-secondary, #475569);
}

.saved-entry-email {
    word-break: break-word;
}

.saved-btn {
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid var(--color-border-light, #e5e7eb);
    border-radius: 10px;
    background: #fff;
    color: var(--color-text-muted, #64748b);
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    justify-content: center;
}

.saved-btn:hover {
    color: var(--color-text, #1e293b);
    border-color: var(--color-text-muted, #94a3b8);
}

.saved-btn-load {
    background: var(--color-primary, #0073e6);
    color: #fff;
    border-color: var(--color-primary, #0073e6);
}

.saved-btn-load:hover {
    background: #005bb5;
    border-color: #005bb5;
    color: #fff;
}

.saved-btn-update {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
}

.reach-search-panel {
    min-width: 0;
}

.reach-search-shell {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 840px;
    margin: 0 auto;
}

.reach-search-header,
.reach-search-form,
.reach-search-results > * {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 24px;
    box-shadow: 0 24px 50px rgba(15, 23, 42, 0.06);
    backdrop-filter: blur(10px);
}

.reach-search-header {
    padding: 28px 30px;
}

.reach-search-kicker,
.reach-actions-kicker,
.reach-person-kicker,
.reach-person-files-kicker {
    display: inline-block;
    margin-bottom: 10px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--color-accent, #0073e6);
}

.reach-search-title {
    margin: 0;
    font-size: 30px;
    line-height: 1.08;
    letter-spacing: -0.03em;
    color: #0f172a;
}

.reach-search-copy,
.reach-actions-copy {
    margin: 14px 0 0;
    font-size: 14px;
    line-height: 1.7;
    color: #475569;
}

.reach-search-form {
    position: relative;
    padding: 24px 30px;
}

.reach-search-label {
    display: block;
    margin-bottom: 10px;
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
}

.reach-search-input-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
}

.reach-search-input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #cbd5e1;
    border-radius: 14px;
    background: #f8fafc;
    color: #0f172a;
    font: inherit;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.reach-search-input:focus {
    outline: none;
    border-color: var(--color-accent, #0073e6);
    box-shadow: 0 0 0 4px rgba(0, 115, 230, 0.12);
    background: #fff;
}

.reach-search-submit {
    padding: 0 18px;
    border-radius: 14px;
    font-size: 13px;
    font-weight: 700;
}

.reach-search-hint {
    margin-top: 12px;
    font-size: 12px;
    color: #64748b;
}

.reach-search-team-action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid rgba(148, 163, 184, 0.2);
}

.reach-search-team-copy {
    font-size: 12px;
    font-weight: 600;
    color: #475569;
}

.reach-search-suggestions {
    position: static;
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0;
}

.reach-search-suggestions.hidden {
    display: none;
}

.reach-search-suggestion {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #fff;
    color: #0f172a;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}

.reach-search-suggestion:hover {
    transform: translateY(-1px);
    border-color: rgba(0, 115, 230, 0.28);
    box-shadow: 0 10px 18px rgba(0, 115, 230, 0.08);
}

.reach-search-suggestion-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.reach-search-suggestion-name {
    font-size: 14px;
    font-weight: 700;
}

.reach-search-suggestion-meta,
.reach-search-suggestion-user {
    font-size: 12px;
    color: #64748b;
}

.reach-search-suggestion-user {
    flex-shrink: 0;
    font-weight: 600;
}

.reach-search-results {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.reach-search-empty-card,
.reach-person-card,
.reach-person-files {
    padding: 24px 30px;
}

.reach-search-loading-card {
    display: flex;
    align-items: center;
    gap: 14px;
}

.reach-inline-spinner {
    width: 22px;
    height: 22px;
    border: 2.5px solid #e2e8f0;
    border-top-color: var(--color-accent, #0073e6);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}

.reach-search-empty-title,
.reach-person-files-title {
    margin: 0;
    font-size: 22px;
    line-height: 1.2;
    color: #0f172a;
}

.reach-search-empty-copy {
    margin: 10px 0 0;
    font-size: 14px;
    line-height: 1.7;
    color: #475569;
}

.reach-person-card {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.reach-person-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.reach-person-name {
    margin: 0;
    font-size: 28px;
    line-height: 1.08;
    letter-spacing: -0.03em;
    color: #0f172a;
}

.reach-person-identity {
    margin-top: 8px;
    font-size: 14px;
    color: #475569;
}

.reach-person-badge {
    flex-shrink: 0;
    padding: 8px 12px;
    border-radius: 999px;
    background: #e8f4fd;
    color: #075985;
    font-size: 12px;
    font-weight: 700;
}

.reach-person-meta-grid,
.reach-person-summary,
.reach-person-file-window {
    display: grid;
    gap: 12px;
}

.reach-person-meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.reach-person-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.reach-person-meta-item,
.reach-person-summary-item,
.reach-person-file-window-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 16px;
    border-radius: 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.reach-person-meta-label,
.reach-person-summary-label,
.reach-person-file-window-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #64748b;
}

.reach-person-meta-item strong,
.reach-person-summary-item strong,
.reach-person-file-window-item strong {
    font-size: 14px;
    line-height: 1.5;
    color: #0f172a;
}

.reach-person-files {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.reach-person-files-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.reach-person-file-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 18px;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.reach-person-file-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.reach-person-file-title {
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
}

.reach-person-file-subtitle {
    margin-top: 4px;
    font-size: 12px;
    color: #64748b;
}

.reach-person-file-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.reach-person-file-window {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.reach-person-file-window-item-wide {
    grid-column: 1 / -1;
}

.saved-btn-delete {
    font-size: 16px;
    font-weight: 700;
    padding: 3px 8px;
    color: var(--color-text-muted, #94a3b8);
    border-color: transparent;
    background: transparent;
}

.saved-btn-delete:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.06);
    border-color: rgba(239, 68, 68, 0.2);
}

.reach-upload-right {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-width: 0;
    gap: 20px;
}

.reach-actions-card {
    width: 100%;
    padding: 24px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(148, 163, 184, 0.18);
    box-shadow: 0 24px 50px rgba(15, 23, 42, 0.06);
    backdrop-filter: blur(10px);
}

.reach-actions-header {
    margin-bottom: 18px;
}

.reach-actions-title {
    margin: 0;
    font-size: 22px;
    line-height: 1.15;
    color: #0f172a;
}

.reach-upload-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    width: 100%;
    max-width: none;
    padding: 40px 28px;
    border: 2px dashed #cbd5e1;
    border-radius: 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.reach-upload-box:hover,
.reach-upload-box.drag-over {
    border-color: var(--color-primary, #0073e6);
    background: rgba(0, 115, 230, 0.04);
}

.reach-upload-box.hidden { display: none; }

.reach-upload-icon {
    color: var(--color-text-muted);
}

.reach-upload-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--color-text);
}

.reach-upload-subtitle {
    margin: 0;
    font-size: 14px;
    color: var(--color-text-muted);
    line-height: 1.5;
}

.reach-upload-btn {
    margin-top: 8px;
    padding: 10px 28px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    color: #fff;
    background: var(--color-primary, #0073e6);
    cursor: pointer;
    transition: background 0.2s;
}

.reach-upload-btn:hover {
    background: #005bb5;
}

.reach-upload-hint {
    margin: 0;
    font-size: 13px;
    color: var(--color-text-muted);
}

.reach-upload-hint a {
    color: var(--color-accent);
    text-decoration: none;
    font-weight: 500;
}

.reach-upload-hint a:hover {
    text-decoration: underline;
}

/* Progress spinner */

.reach-upload-progress {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    width: 100%;
    padding: 28px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(148, 163, 184, 0.18);
    box-shadow: 0 24px 50px rgba(15, 23, 42, 0.06);
}

.reach-upload-progress.hidden { display: none; }

.reach-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--color-border-light);
    border-top-color: var(--color-primary, #0073e6);
    border-radius: 50%;
    animation: reach-spin 0.8s linear infinite;
}

@keyframes reach-spin {
    to { transform: rotate(360deg); }
}

.reach-progress-text {
    font-size: 14px;
    color: var(--color-text-muted);
}

/* Batch upload progress */

.reach-batch-progress {
    width: 100%;
    padding: 24px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(148, 163, 184, 0.18);
    box-shadow: 0 24px 50px rgba(15, 23, 42, 0.06);
}

.reach-batch-progress.hidden { display: none; }

.reach-batch-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text);
    margin: 0 0 8px;
    text-align: center;
}

.reach-batch-counter {
    font-size: 13px;
    color: var(--color-text-muted);
    text-align: center;
    margin-bottom: 16px;
}

.reach-batch-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.reach-batch-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    background: var(--color-surface, #f8fafc);
    font-size: 13px;
}

.reach-batch-icon {
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.reach-batch-pending { color: #94a3b8; }
.reach-batch-running { color: var(--color-primary, #0073e6); }
.reach-batch-ok { color: #10b981; font-weight: 700; }
.reach-batch-err { color: #ef4444; font-weight: 700; }

.reach-batch-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--color-border-light, #e2e8f0);
    border-top-color: var(--color-primary, #0073e6);
    border-radius: 50%;
    animation: reach-spin 0.8s linear infinite;
}

.reach-batch-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--color-text);
}

.reach-batch-status {
    flex-shrink: 0;
    font-size: 12px;
    color: var(--color-text-muted);
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Error state */

.reach-upload-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
    width: 100%;
    padding: 24px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(248, 113, 113, 0.2);
    box-shadow: 0 24px 50px rgba(15, 23, 42, 0.06);
}

.reach-upload-error.hidden { display: none; }

.reach-upload-error p {
    margin: 0;
    font-size: 14px;
    color: #c0392b;
}

.reach-retry-btn {
    font-size: 13px;
}

@media (max-width: 1180px) {
    .reach-upload {
        grid-template-columns: minmax(0, 1fr);
    }

    .reach-actions-card {
        max-width: 520px;
    }
}

@media (max-width: 900px) {
    .reach-upload {
        grid-template-columns: 1fr;
        padding: 16px;
    }

    .reach-search-header,
    .reach-search-form,
    .reach-search-results > *,
    .reach-actions-card,
    .reach-upload-progress,
    .reach-batch-progress,
    .reach-upload-error {
        max-height: none;
    }

    .reach-upload-right {
        grid-column: auto;
        align-items: stretch;
    }

    .reach-search-title {
        font-size: 24px;
    }

    .reach-back-btn {
        position: static;
        margin: 12px 16px 0;
        align-self: flex-start;
    }

    .reach-toolbar {
        padding-left: 16px;
    }

    .reach-person-header,
    .reach-person-file-header,
    .reach-person-files-header {
        flex-direction: column;
    }

    .reach-person-meta-grid,
    .reach-person-summary,
    .reach-person-file-window,
    .reach-search-input-row {
        grid-template-columns: 1fr;
    }

    .reach-search-team-action {
        flex-direction: column;
        align-items: stretch;
    }
}

/* Toolbar with sub-tabs */

.reach-views {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.reach-views.hidden { display: none; }

.reach-back-btn {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 20;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
    border-color: rgba(148, 163, 184, 0.45);
    background: rgba(255, 255, 255, 0.96);
    font-weight: 700;
}

.reach-back-btn:hover {
    border-color: var(--color-accent, #0073e6);
    color: var(--color-accent, #0073e6);
}

.reach-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 8px 150px;
    border-bottom: 1px solid var(--color-border-light);
    background: var(--color-surface, #fff);
    flex-shrink: 0;
}

.reach-subtabs {
    display: flex;
    gap: 4px;
    background: var(--color-bg, #f3f4f6);
    border-radius: 8px;
    padding: 3px;
}

.reach-subtab {
    padding: 6px 18px;
    font-size: 13px;
    font-weight: 500;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: all 0.15s;
}

.reach-subtab:hover {
    color: var(--color-text);
}

.reach-subtab.active {
    background: #fff;
    color: var(--color-text);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    font-weight: 600;
}

.reach-toolbar-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.reach-reload-btn {
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    color: var(--color-text-muted);
    border-color: var(--color-border-light);
    transition: all 0.15s;
}

.reach-reload-btn:hover {
    color: var(--color-primary, #0073e6);
    border-color: var(--color-primary, #0073e6);
}

.reach-download-btn {
    font-size: 12px;
    text-decoration: none;
    background: var(--color-accent);
    color: #fff !important;
    border: 1px solid var(--color-accent);
    border-radius: var(--radius-sm);
    padding: 4px 12px;
    font-weight: 600;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
}

.reach-download-btn:hover {
    background: var(--color-accent-hover);
    border-color: var(--color-accent-hover);
}

.reach-download-btn.hidden {
    display: none;
}

/* Power Map / Org Map containers inside reach */

.powermap-container {
    flex: 1;
    position: relative;
}

.powermap-container.hidden {
    display: none;
}

.powermap-layout {
    display: flex;
    height: calc(100vh - 56px);
}

.powermap-graph {
    flex: 1;
    position: relative;
    background: var(--color-bg);
    overflow: hidden;
}

.powermap-graph svg {
    display: block;
    width: 100%;
    height: 100%;
    cursor: grab;
}

.powermap-graph svg:active {
    cursor: grabbing;
}

.powermap-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--color-text-muted);
    font-size: 14px;
}

.powermap-loading::after {
    content: "";
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-left: 8px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* Power Map sidebar */

.powermap-sidebar {
    width: 340px;
    background: var(--color-surface);
    border-left: 1px solid var(--color-border);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.powermap-sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--color-border);
}

.pm-sidebar-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #fff;
    color: #334155;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.pm-sidebar-back:hover {
    border-color: var(--color-accent, #0073e6);
    color: var(--color-accent, #0073e6);
    background: #f8fbff;
}

.powermap-sidebar-header h3 {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-muted);
    margin: 0;
}

.pm-focal-card {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.pm-focal-photo {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--color-tag-bg);
    flex-shrink: 0;
}

.pm-focal-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text);
}

.pm-focal-pos {
    font-size: 12px;
    color: var(--color-text-secondary);
}

.pm-summary {
    display: flex;
    gap: 20px;
}

.pm-summary-item {
    display: flex;
    flex-direction: column;
}

.pm-summary-val {
    font-size: 22px;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.1;
}

.pm-summary-label {
    font-size: 11px;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Contact list */

.powermap-contact-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}

.pm-contact-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    cursor: pointer;
    transition: background var(--transition);
    border-bottom: 1px solid var(--color-border-light);
}

.pm-contact-item:hover,
.pm-contact-item.pm-contact-active {
    background: var(--color-accent-light);
}

.pm-contact-rank {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--color-tag-bg);
    color: var(--color-text-muted);
    font-size: 10px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pm-contact-photo {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--color-tag-bg);
    flex-shrink: 0;
}

.pm-contact-info {
    flex: 1;
    min-width: 0;
}

.pm-contact-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pm-contact-meta {
    font-size: 11px;
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pm-contact-score-col {
    flex-shrink: 0;
    text-align: right;
    min-width: 70px;
}

.pm-contact-score {
    font-size: 15px;
    font-weight: 700;
    color: var(--color-text);
}

.pm-contact-bar-bg {
    height: 4px;
    background: var(--color-border-light);
    border-radius: 2px;
    margin-top: 3px;
    width: 60px;
    margin-left: auto;
}

.pm-contact-bar {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s ease;
}

.pm-contact-detail {
    font-size: 9px;
    color: var(--color-text-muted);
    margin-top: 2px;
}

.pm-contact-details-btn {
    flex-shrink: 0;
    padding: 4px 10px;
    background: transparent;
    color: var(--color-accent);
    border: 1px solid var(--color-accent);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    opacity: 0;
    white-space: nowrap;
}

.pm-contact-item:hover .pm-contact-details-btn,
.pm-contact-item.pm-contact-active .pm-contact-details-btn {
    opacity: 1;
}

.pm-contact-details-btn:hover {
    background: var(--color-accent);
    color: #fff;
}

/* Tooltip */

.pm-tooltip {
    position: absolute;
    background: white;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 12px 16px;
    box-shadow: var(--shadow-lg);
    pointer-events: none;
    z-index: 50;
    max-width: 260px;
    transition: opacity 150ms;
}

.pm-tooltip-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 2px;
}

.pm-tooltip-pos {
    font-size: 12px;
    color: var(--color-text-secondary);
}

.pm-tooltip-team {
    font-size: 11px;
    color: var(--color-text-muted);
    margin-bottom: 8px;
}

.pm-tooltip-stats {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--color-text-secondary);
    margin-bottom: 4px;
}

.pm-tooltip-stats strong {
    color: var(--color-text);
}

.pm-tooltip-org {
    font-size: 11px;
    color: var(--color-accent);
    font-weight: 500;
}

/* Pinned card (on click) */

.pm-pinned-card {
    position: absolute;
    background: white;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 14px 16px;
    box-shadow: var(--shadow-lg);
    z-index: 60;
    max-width: 280px;
    animation: pmFadeIn 0.1s ease;
}

.pm-pinned-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

.pm-pinned-info {
    flex: 1;
    min-width: 0;
}

.pm-pinned-dismiss {
    width: 22px;
    height: 22px;
    border: none;
    background: var(--color-tag-bg);
    border-radius: 50%;
    font-size: 14px;
    cursor: pointer;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--transition);
}

.pm-pinned-dismiss:hover {
    background: var(--color-border);
    color: var(--color-text);
}

.pm-pinned-card .pm-tooltip-stats {
    margin-top: 8px;
}

.pm-pinned-card .pm-tooltip-org {
    margin-top: 4px;
}

.pm-pinned-btn {
    display: block;
    width: 100%;
    margin-top: 10px;
    padding: 7px 0;
    background: var(--color-accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition);
}

.pm-pinned-btn:hover {
    background: var(--color-accent-hover);
}

.pm-hovertip {
    pointer-events: none;
}

/* Power Map filter bar in sidebar */

.pm-filter-bar {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 16px;
}

.pm-filter-input,
.pm-filter-select {
    font-family: var(--font);
    font-size: 12px;
    padding: 7px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-bg);
    color: var(--color-text);
    outline: none;
    width: 100%;
    transition: border-color var(--transition);
}

.pm-filter-input:focus,
.pm-filter-select:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 2px var(--color-accent-light);
}

/* Visibility toggle group */

.pm-visibility-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
}

.pm-vis-toggle {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    background: rgba(209, 213, 219, 0.10);
    border: 1px solid var(--color-border-light);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
    font-size: 11px;
    color: var(--color-text-muted);
    user-select: none;
}

.pm-vis-toggle:hover {
    background: rgba(209, 213, 219, 0.22);
}

.pm-vis-toggle:has(input:checked) {
    background: rgba(0, 115, 230, 0.06);
    border-color: rgba(0, 115, 230, 0.25);
    color: var(--color-text);
}

.pm-vis-toggle input[type="checkbox"] {
    accent-color: var(--color-accent);
    flex-shrink: 0;
    margin: 0;
}

.pm-vis-toggle span {
    font-weight: 500;
    white-space: nowrap;
}

.pm-vis-toggle-highlight {
    border-color: rgba(139, 92, 246, 0.25);
}

.pm-vis-toggle-highlight:has(input:checked) {
    background: rgba(139, 92, 246, 0.08);
    border-color: rgba(139, 92, 246, 0.4);
}

.pm-vis-toggle-highlight:has(input:checked) span {
    color: #7c3aed;
}

.pm-cluster-level-select {
    font-size: 11px;
    padding: 4px 8px;
    border: 1px solid var(--color-border-light);
    border-radius: 6px;
    background: rgba(209, 213, 219, 0.10);
    color: var(--color-text);
    cursor: pointer;
    font-weight: 500;
    transition: border-color 0.15s ease, opacity 0.15s ease;
}
.pm-cluster-level-select:hover:not(:disabled) {
    border-color: rgba(0, 115, 230, 0.35);
}
.pm-cluster-level-select:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* Ghost node tooltip/badge */

.pm-tooltip-ghost {
    color: #9ca3af !important;
}

.pm-ghost-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 10px;
    font-weight: 600;
    color: #6b7280;
    background: #f3f4f6;
    border-radius: 4px;
    letter-spacing: 0.03em;
}

/* Score range slider */

.pm-range-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    margin-top: 6px;
}

.pm-range-label {
    font-size: 11px;
    color: var(--color-text-muted);
    white-space: nowrap;
    min-width: 80px;
}

.pm-range-label strong {
    color: var(--color-accent);
    font-weight: 700;
}

.pm-range-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: var(--color-border-light);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.pm-range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--color-accent);
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: transform 0.1s ease;
}

.pm-range-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.pm-range-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--color-accent);
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    cursor: pointer;
}

.pm-range-slider-acct::-webkit-slider-thumb {
    background: #f59e0b;
}

.pm-range-slider-acct::-moz-range-thumb {
    background: #f59e0b;
}

.pm-range-slider-acct + .pm-range-label strong,
.pm-range-row:has(.pm-range-slider-acct) strong {
    color: #d97706;
}

.pm-filter-count {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-muted);
    margin-top: 12px;
}

/* Power Map Modal */

.pm-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
    animation: pmFadeIn 0.15s ease;
}

.pm-modal-overlay.hidden {
    display: none;
}

@keyframes pmFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.pm-modal {
    background: var(--color-surface);
    border-radius: 12px;
    width: 520px;
    max-width: 92vw;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    position: relative;
    animation: pmSlideIn 0.2s ease;
}

@keyframes pmSlideIn {
    from { transform: translateY(16px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.pm-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    border: none;
    background: var(--color-tag-bg);
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    z-index: 1;
}

.pm-modal-close:hover {
    background: var(--color-border);
    color: var(--color-text);
}

.pm-modal-content {
    padding: 28px;
}

.pm-modal-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.pm-modal-photo {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--color-tag-bg);
    flex-shrink: 0;
}

.pm-modal-header-info {
    flex: 1;
    min-width: 0;
}

.pm-modal-name {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.2;
}

.pm-modal-subtitle {
    font-size: 13px;
    color: var(--color-text-secondary);
    margin-top: 2px;
}

.pm-modal-score-badge {
    flex-shrink: 0;
    text-align: center;
    background: var(--color-primary);
    color: #fff;
    border-radius: 12px;
    padding: 12px 18px;
    min-width: 70px;
}

.pm-modal-score-val {
    font-size: 26px;
    font-weight: 800;
    line-height: 1;
}

.pm-modal-score-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.7;
    margin-top: 4px;
}

/* KPIs row */

.pm-modal-kpis {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 24px;
    padding: 16px;
    background: var(--color-bg);
    border-radius: var(--radius);
}

.pm-modal-kpi {
    text-align: center;
}

.pm-modal-kpi-val {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.2;
}

.pm-modal-kpi-label {
    font-size: 10px;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-top: 2px;
}

.pm-modal-kpi .pm-modal-tag {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-accent);
}

/* Meeting breakdown bars */

.pm-modal-section-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-muted);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--color-border-light);
}

.pm-modal-bars {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pm-modal-bar-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pm-modal-bar-clickable {
    cursor: pointer;
    border-radius: 6px;
    padding: 4px 8px;
    margin: -4px -8px;
    transition: background 0.15s;
}
.pm-modal-bar-clickable:hover {
    background: rgba(0, 115, 230, 0.07);
}

.pm-modal-bar-label {
    width: 160px;
    font-size: 12px;
    color: var(--color-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

.pm-modal-bar-track {
    flex: 1;
    height: 18px;
    background: var(--color-bg);
    border-radius: 4px;
    overflow: hidden;
}

.pm-modal-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s ease;
    min-width: 2px;
}

.pm-modal-bar-value {
    width: 36px;
    text-align: right;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
    flex-shrink: 0;
}

/* Legend (HTML overlay, fixed bottom-left of graph) */

.pm-legend {
    position: absolute;
    bottom: 16px;
    left: 16px;
    z-index: 10;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 10px;
    color: var(--color-text-muted);
    box-shadow: var(--shadow-sm);
    pointer-events: auto;
    max-width: 200px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pm-legend-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pm-legend-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--color-text);
}

.pm-legend-gradient {
    height: 10px;
    border-radius: 3px;
    width: 100%;
}

.pm-legend-gradient-labels {
    display: flex;
    justify-content: space-between;
    font-size: 9px;
}

.pm-legend-zones {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.pm-legend-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 8px;
}

.pm-legend-zone-box {
    width: 26px;
    height: 12px;
    border-radius: 3px;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.pm-legend-symbols {
    gap: 6px;
}

.pm-legend-line {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 9px;
    line-height: 1;
}

.pm-legend-line-sample {
    width: 28px;
    height: 2px;
    flex-shrink: 0;
    display: inline-block;
    border-radius: 1px;
}

.pm-legend-line-dashed {
    background: none !important;
    height: 0;
    border-top: 2px dashed;
}

.pm-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    display: inline-block;
}

.pm-legend-dot-ghost {
    background: #d1d5db;
    border: 1.5px dashed #9ca3af;
}

.pm-legend-rect {
    width: 12px;
    height: 10px;
    border-radius: 2px;
    flex-shrink: 0;
    display: inline-block;
}

/* Sidebar tabs (Contacts / Accounts) */

.pm-sidebar-tabs {
    display: flex;
    gap: 0;
    margin: 12px 0 8px;
    border-bottom: 2px solid var(--color-border-light);
}

.pm-sidebar-tab {
    flex: 1;
    padding: 8px 0;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    color: var(--color-text-muted);
    transition: color var(--transition), border-color var(--transition);
}

.pm-sidebar-tab:hover {
    color: var(--color-text-secondary);
}

.pm-sidebar-tab.active {
    color: var(--color-accent);
    border-bottom-color: var(--color-accent);
}

/* Account items in sidebar */

.pm-acct-icon-small {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fef3c7;
    border-radius: 6px;
}

.pm-account-item {
    border-left: 3px solid #f59e0b;
}

/* Account tooltip label */

.pm-tooltip-account {
    color: #d97706 !important;
}

/* Account modal contacts list */

.pm-acct-contacts {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 240px;
    overflow-y: auto;
}

.pm-acct-contact-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    background: var(--color-bg);
    border-radius: var(--radius-sm);
    font-size: 12px;
}

.pm-acct-contact-name {
    font-weight: 600;
    color: var(--color-text);
    flex-shrink: 0;
}

.pm-acct-contact-pos {
    color: var(--color-text-muted);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pm-acct-contact-stat {
    color: var(--color-text-secondary);
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Modal back button */

.pm-modal-back {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    margin-bottom: 10px;
    background: var(--color-tag-bg);
    color: var(--color-accent);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition);
}

.pm-modal-back:hover {
    background: var(--color-accent-light);
    border-color: var(--color-accent);
}

/* Person chips (clickable links in modal) */

.pm-modal-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 4px;
}

.pm-person-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: var(--color-accent-light);
    color: var(--color-accent);
    border: 1px solid rgba(0, 115, 230, 0.15);
    border-radius: 14px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background var(--transition), border-color var(--transition);
}

.pm-person-chip:hover {
    background: rgba(0, 115, 230, 0.15);
    border-color: var(--color-accent);
}

.pm-chip-score {
    font-size: 10px;
    font-weight: 700;
    color: var(--color-text-muted);
    background: rgba(0, 0, 0, 0.06);
    border-radius: 8px;
    padding: 1px 5px;
    min-width: 18px;
    text-align: center;
}

/* Manager chip inside KPI */
.pm-modal-kpi .pm-person-chip {
    font-size: 12px;
    padding: 3px 8px;
}

.pm-acct-ext-row {
    border-left: 3px solid #f59e0b;
}

.pm-acct-ext-email {
    font-size: 11px;
    color: var(--color-text-muted);
}

.pm-modal-acct-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fef3c7;
    border-radius: 10px;
    flex-shrink: 0;
}

/* ==========================================================================
   Org Map — Tree with proximity heatmap
   ========================================================================== */

.orgmap-container {
    flex: 1;
    position: relative;
}

.orgmap-container.hidden {
    display: none;
}

.orgmap-layout {
    display: flex;
    height: calc(100vh - 56px);
}

.orgmap-tree {
    flex: 1;
    padding: 16px 20px;
    overflow: auto;
}

/* Legend panel */

.orgmap-legend {
    width: 220px;
    background: var(--color-surface);
    border-left: 1px solid var(--color-border);
    padding: 20px;
    overflow-y: auto;
    flex-shrink: 0;
}

.om-legend-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-muted);
    margin-bottom: 10px;
}

.om-legend-gradient {
    height: 12px;
    border-radius: 4px;
    background: linear-gradient(to right,
        #ffffcc, #ffeda0, #fed976, #feb24c, #fd8d3c, #fc4e2a, #e31a1c, #b10026);
    margin-bottom: 4px;
}

.om-legend-labels {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: var(--color-text-muted);
    margin-bottom: 20px;
}

.om-legend-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.om-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--color-text-secondary);
}

.om-legend-note {
    font-size: 10px;
    color: var(--color-text-muted);
    line-height: 1.5;
    border-top: 1px solid var(--color-border-light);
    padding-top: 12px;
}

/* Tree nodes */

.om-node {
    position: relative;
}

.om-children {
    margin-left: 22px;
    border-left: 1px solid var(--color-border-light);
}

.om-children.collapsed {
    display: none;
}

/* Row */

.om-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    margin: 1px 0;
    border-radius: var(--radius-sm);
    cursor: default;
    transition: background var(--transition);
    position: relative;
}

.om-row:hover {
    background: rgba(0, 115, 230, 0.06) !important;
}

/* Heat bar on the left edge */

.om-heat-bar {
    width: 4px;
    align-self: stretch;
    border-radius: 2px;
    flex-shrink: 0;
    min-height: 20px;
    background: transparent;
}

/* Info */

.om-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.om-name {
    font-weight: 500;
    font-size: 13px;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.om-position {
    font-size: 11px;
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.om-tags {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

/* Scores */

.om-scores {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.om-score-personal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    padding: 2px 7px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.om-score-agg {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--color-tag-bg);
    white-space: nowrap;
}

.om-score-agg-val {
    font-size: 12px;
    font-weight: 700;
    color: var(--color-text);
}

.om-score-agg-label {
    font-size: 10px;
    color: var(--color-text-muted);
}

/* Subtree engagement bar */

.om-subtree-bar-bg {
    width: 80px;
    height: 6px;
    background: var(--color-border-light);
    border-radius: 3px;
    overflow: hidden;
    flex-shrink: 0;
}

.om-subtree-bar {
    height: 100%;
    border-radius: 3px;
    background: transparent;
    transition: width 0.3s ease;
}

/* ===== Analytics ===== */

.analytics-container {
    flex: 1;
    overflow-y: auto;
}

.analytics-container.hidden { display: none; }

.analytics-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 28px 40px;
}

/* KPI row */

.an-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
    margin-bottom: 28px;
}

.an-kpi {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 20px 12px;
    background: #fff;
    border: 1px solid var(--color-border-light, #e5e7eb);
    border-radius: 12px;
    text-align: center;
}

.an-kpi-icon {
    color: var(--color-primary, #0073e6);
    margin-bottom: 4px;
}

.an-kpi-val {
    font-size: 24px;
    font-weight: 700;
    color: var(--color-text, #1e293b);
    line-height: 1.2;
}

.an-kpi-label {
    font-size: 12px;
    color: var(--color-text-muted, #64748b);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 500;
}

/* Card grid */

.an-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
}

.an-card {
    background: #fff;
    border: 1px solid var(--color-border-light, #e5e7eb);
    border-radius: 12px;
    padding: 20px 22px;
    overflow: hidden;
}

.an-card-wide {
    grid-column: span 2;
}

.an-card-title {
    margin: 0 0 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text, #1e293b);
}

/* Horizontal bar rows */

.an-bars {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 420px;
    overflow-y: auto;
}

.an-bar-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.an-bar-label {
    width: 160px;
    min-width: 120px;
    font-size: 12px;
    color: var(--color-text, #1e293b);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
    text-align: right;
}

.an-bar-track {
    flex: 1;
    height: 20px;
    background: var(--color-bg, #f3f4f6);
    border-radius: 4px;
    overflow: hidden;
}

.an-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s ease;
    min-width: 2px;
}

.an-bar-value {
    width: 60px;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text, #1e293b);
    text-align: right;
    flex-shrink: 0;
}

.an-empty {
    font-size: 13px;
    color: var(--color-text-muted, #64748b);
    font-style: italic;
}

/* Donut */

.an-donut {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    flex-wrap: wrap;
}

.an-donut svg {
    flex-shrink: 0;
}

.an-donut-legend {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
    min-width: 180px;
    max-height: 220px;
    overflow-y: auto;
}

.an-donut-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}

.an-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.an-donut-label {
    color: var(--color-text, #1e293b);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.an-donut-val {
    color: var(--color-text-muted, #64748b);
    white-space: nowrap;
    flex-shrink: 0;
}

/* Clickable bar rows */

.an-bar-clickable {
    cursor: pointer;
    border-radius: 6px;
    padding: 2px 6px;
    margin: -2px -6px;
    transition: background 0.15s;
}
.an-bar-clickable:hover {
    background: rgba(0, 115, 230, 0.07);
}

/* Analytics drill-down modal */

.an-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9000;
    background: rgba(15, 23, 42, 0);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.25s;
}
.an-modal-overlay.visible {
    background: rgba(15, 23, 42, 0.55);
}

.an-modal {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    width: 90vw;
    max-width: 960px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: anModalIn 0.25s ease;
}

@keyframes anModalIn {
    from { opacity: 0; transform: translateY(16px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.an-modal-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 24px;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.an-modal-badge {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    flex-shrink: 0;
}

.an-modal-title {
    font-size: 17px;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
    flex: 1;
}

.an-modal-count {
    font-size: 13px;
    color: #64748b;
    white-space: nowrap;
}

.an-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #94a3b8;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.15s;
}
.an-modal-close:hover {
    color: #1e293b;
}

.an-modal-body {
    overflow-y: auto;
    padding: 0;
    flex: 1;
}

.an-modal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.an-modal-table thead {
    position: sticky;
    top: 0;
    z-index: 1;
}

.an-modal-table th {
    background: #f8fafc;
    color: #475569;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}

.an-modal-table td {
    padding: 10px 14px;
    border-bottom: 1px solid #f1f5f9;
    color: #1e293b;
    vertical-align: top;
}

.an-modal-table tbody tr:hover {
    background: #f8fafc;
}

.an-modal-td-date {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    width: 100px;
}

.an-modal-td-time {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    width: 90px;
    color: #64748b;
}

.an-modal-td-title {
    max-width: 340px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

.an-modal-td-parts {
    max-width: 320px;
}

.an-modal-part {
    display: inline-block;
    background: #f1f5f9;
    color: #334155;
    border-radius: 4px;
    padding: 2px 7px;
    font-size: 11px;
    margin: 1px 3px 1px 0;
    white-space: nowrap;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.an-modal-part-none {
    background: transparent;
    color: #94a3b8;
}

.an-modal-td-n {
    width: 36px;
    text-align: center;
    color: #64748b;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 800px) {
    .an-grid {
        grid-template-columns: 1fr;
    }
    .an-card-wide {
        grid-column: span 1;
    }
    .an-modal {
        width: 96vw;
        max-height: 90vh;
        border-radius: 10px;
    }
    .an-modal-td-title {
        max-width: 200px;
    }
    .an-modal-td-parts {
        max-width: 180px;
    }
}

/* ===================================================================== */
/*  Scoring explainer page                                                */
/* ===================================================================== */

.scoring-container {
    padding: 0;
    overflow-y: auto;
    max-height: calc(100vh - 120px);
}

.sc-page {
    max-width: 780px;
    margin: 0 auto;
    padding: 32px 24px 48px;
}

.sc-hero {
    text-align: center;
    margin-bottom: 36px;
}

.sc-hero-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff;
    margin-bottom: 14px;
}

.sc-hero-title {
    font-size: 24px;
    font-weight: 800;
    color: #1e293b;
    margin: 0 0 8px;
}

.sc-hero-subtitle {
    font-size: 15px;
    color: #64748b;
    line-height: 1.6;
    max-width: 560px;
    margin: 0 auto;
}

.sc-section {
    margin-bottom: 32px;
}

.sc-section-title {
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 14px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e2e8f0;
}

/* Steps */

.sc-steps {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sc-step {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.sc-step-num {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #6366f1;
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sc-step-text {
    font-size: 14px;
    color: #334155;
    line-height: 1.55;
    padding-top: 4px;
}

.sc-highlight {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff;
    padding: 1px 8px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 13px;
}

/* Score table */

.sc-table {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sc-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: #f8fafc;
    border-radius: 8px;
    transition: background 0.15s;
}
.sc-row:hover {
    background: #f1f5f9;
}

.sc-row-pts {
    flex-shrink: 0;
    width: 42px;
    text-align: center;
}

.sc-pts-badge {
    display: inline-block;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    width: 34px;
    height: 34px;
    line-height: 34px;
    border-radius: 8px;
    text-align: center;
}

.sc-row-bar-wrap {
    width: 100px;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
}

.sc-row-bar {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #8b5cf6);
    border-radius: 4px;
    transition: width 0.4s ease;
}

.sc-row-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.sc-row-type {
    font-weight: 600;
    font-size: 14px;
    color: #1e293b;
}

.sc-row-desc {
    font-size: 12px;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Zero types */

.sc-muted {
    font-size: 13px;
    color: #64748b;
    margin: 0 0 10px;
    line-height: 1.5;
}

.sc-zero-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.sc-zero-tag {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 6px;
    background: #f1f5f9;
    color: #64748b;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid #e2e8f0;
}

/* Example section */

.sc-example-section {
    background: #f8fafc;
    border-radius: 12px;
    padding: 20px 24px;
    border: 1px solid #e2e8f0;
}

.sc-example-section .sc-section-title {
    border-bottom-color: #cbd5e1;
}

.sc-example-row {
    font-size: 14px;
    color: #334155;
    margin-bottom: 14px;
    line-height: 1.5;
}

.sc-example-calc {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sc-calc-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: #475569;
    padding: 6px 0;
    border-bottom: 1px dashed #e2e8f0;
}

.sc-calc-val {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #6366f1;
    white-space: nowrap;
}

.sc-calc-result {
    border-bottom: none;
    padding-top: 10px;
    border-top: 2px solid #6366f1;
    font-weight: 600;
    color: #1e293b;
}

.sc-calc-result .sc-calc-val {
    font-size: 16px;
    color: #6366f1;
}

@media (max-width: 600px) {
    .sc-page {
        padding: 20px 14px 32px;
    }
    .sc-row-bar-wrap {
        display: none;
    }
    .sc-row-desc {
        white-space: normal;
    }
}

/* ===================================================================== */
/*  Team Reach                                                            */
/* ===================================================================== */

.teamreach-container {
    padding: 0;
    height: calc(100vh - 88px);
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

#teamreachContent {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Upload-area alt link */

.reach-upload-alt {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
}
.reach-upload-alt-sep {
    color: #94a3b8;
    font-size: 13px;
}

/* Setup */

.tr-setup {
    max-width: 680px;
    margin: 0 auto;
    padding: 20px 24px 72px;
    overflow: visible;
    min-height: calc(100vh - 120px);
}

.tr-hero {
    text-align: center;
    margin-bottom: 32px;
}

.tr-hero-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: linear-gradient(135deg, #0073e6 0%, #06b6d4 100%);
    color: #fff;
    margin-bottom: 14px;
}

.tr-hero-title {
    font-size: 24px;
    font-weight: 800;
    color: #1e293b;
    margin: 0 0 8px;
}

.tr-hero-subtitle {
    font-size: 15px;
    color: #64748b;
    line-height: 1.6;
    max-width: 500px;
    margin: 0 auto;
}

/* Manager search */

.tr-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 8px;
}

.tr-manager-search {
    margin-bottom: 24px;
}

/* Saved team configs */
.tr-saved-configs {
    margin-bottom: 24px;
    padding: 16px;
    background: #f8fafc;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}
.tr-saved-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
}
.tr-saved-item:last-child { border-bottom: none; }
.tr-saved-name {
    font-weight: 600;
    font-size: 14px;
    color: #1e293b;
}
.tr-saved-meta {
    font-size: 11px;
    color: #64748b;
    margin-top: 2px;
}
.tr-saved-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}
.tr-saved-del {
    color: #ef4444 !important;
    border-color: #fca5a5 !important;
    min-width: 28px;
    padding: 4px 6px !important;
}

.tr-search-wrap {
    position: relative;
}

.tr-search-input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    color: #1e293b;
    background: #fff;
    transition: border-color 0.15s;
    box-sizing: border-box;
}
.tr-search-input:focus {
    outline: none;
    border-color: #0073e6;
    box-shadow: 0 0 0 3px rgba(0, 115, 230, 0.1);
}

.tr-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 100;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    max-height: min(420px, calc(100vh - 260px));
    overflow-y: auto;
    margin-top: 4px;
}

.tr-search-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.1s;
}
.tr-search-item:hover {
    background: #f1f5f9;
}

.tr-search-photo {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.tr-search-name {
    font-weight: 600;
    font-size: 14px;
    color: #1e293b;
}

.tr-search-meta {
    font-size: 12px;
    color: #64748b;
}

.tr-search-empty {
    padding: 16px;
    text-align: center;
    color: #94a3b8;
    font-size: 13px;
}

/* Selected manager */

.tr-selected-manager {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
    border-radius: 10px;
    margin-bottom: 20px;
    border: 1px solid #bae6fd;
}

.tr-selected-manager-loading {
    align-items: center;
}

.tr-selected-manager-loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #bae6fd;
    border-top-color: #0284c7;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

.tr-selected-manager-loading-copy {
    min-width: 0;
}

.tr-mgr-photo {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.tr-mgr-name {
    font-weight: 700;
    font-size: 16px;
    color: #0c4a6e;
}

.tr-mgr-meta {
    font-size: 13px;
    color: #0369a1;
}

/* Reports header */

.tr-reports-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.tr-reports-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.tr-upload-progress {
    font-size: 13px;
    color: #64748b;
    font-weight: 600;
}

/* Bulk upload zone */

.tr-bulk-upload {
    margin-bottom: 12px;
}

.tr-bulk-drop {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 20px;
    border: 2px dashed var(--color-border-light, #cbd5e1);
    border-radius: 10px;
    background: var(--color-surface, #f8fafc);
    font-size: 13px;
    color: var(--color-text-muted, #64748b);
    transition: border-color 0.15s, background 0.15s;
    cursor: default;
}

.tr-bulk-drop.drag-over {
    border-color: var(--color-primary, #0073e6);
    background: rgba(0, 115, 230, 0.04);
}

.tr-bulk-drop.hidden { display: none; }

.tr-bulk-drop svg {
    flex-shrink: 0;
    opacity: 0.5;
}

.tr-bulk-browse-btn {
    cursor: pointer;
}

.tr-bulk-status {
    text-align: center;
    padding: 14px;
    font-size: 13px;
    color: var(--color-text-muted, #64748b);
    font-weight: 500;
}

.tr-bulk-status.hidden { display: none; }

/* Report slots */

.tr-reports-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 20px;
}

.tr-report-slot {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    transition: background 0.15s, border-color 0.15s;
}
.tr-report-slot:hover {
    background: #f1f5f9;
}

.tr-report-slot-loading {
    background: #eff6ff;
    border-style: dashed;
    border-color: #bfdbfe;
    cursor: default;
}

.tr-report-slot-loading:hover {
    background: #eff6ff;
}

.tr-report-slot-loading-copy {
    min-width: 0;
}

.tr-report-slot-loading-title {
    font-size: 14px;
    font-weight: 600;
    color: #1e3a8a;
}

.tr-report-slot-loading-meta {
    margin-top: 2px;
    font-size: 12px;
    color: #64748b;
}

.tr-slot-done {
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.tr-slot-selected {
    border-color: rgba(0, 115, 230, 0.28);
    box-shadow: 0 8px 18px rgba(0, 115, 230, 0.08);
}

.tr-slot-manager {
    border-left: 3px solid #0a2540;
}

.tr-slot-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 78px;
    font-size: 11px;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    flex-shrink: 0;
}

.tr-slot-checkbox {
    width: 16px;
    height: 16px;
    accent-color: var(--color-primary, #0073e6);
}

.tr-slot-badge {
    display: inline-block;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: #0a2540;
    color: #fff;
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: 6px;
    vertical-align: middle;
}

.tr-slot-color {
    width: 6px;
    height: 32px;
    border-radius: 3px;
    flex-shrink: 0;
}

.tr-slot-photo {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.tr-slot-info {
    flex: 1;
    min-width: 0;
}

.tr-slot-name {
    font-weight: 600;
    font-size: 13px;
    color: #1e293b;
}

.tr-slot-pos {
    font-size: 11px;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tr-slot-source {
    margin-top: 4px;
}

.tr-slot-source-label {
    font-size: 11px;
    font-weight: 600;
    color: #0f172a;
}

.tr-slot-source-subtitle {
    margin-top: 8px;
    font-size: 11px;
    font-weight: 600;
    color: #475569;
}

.tr-slot-source-meta {
    font-size: 11px;
    color: #64748b;
    margin-top: 2px;
}

.tr-slot-source-muted {
    margin-top: 4px;
    font-size: 11px;
    color: #94a3b8;
}

.tr-slot-select {
    width: 100%;
    max-width: 320px;
    margin-top: 6px;
    padding: 6px 8px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
    color: #0f172a;
    font-size: 12px;
}

.tr-selected-analysis-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

.tr-selected-analysis-item {
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid #dbeafe;
}

.tr-selected-analysis-period {
    font-size: 11px;
    font-weight: 700;
    color: #0f172a;
}

.tr-selected-analysis-meta {
    margin-top: 3px;
    font-size: 11px;
    color: #64748b;
    word-break: break-word;
}

.tr-saved-analysis-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.tr-saved-analysis-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 9px 10px;
    border: 1px solid #dbe4f0;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
}

.tr-saved-analysis-option input {
    margin-top: 2px;
    width: 16px;
    height: 16px;
    accent-color: var(--color-primary, #0073e6);
    flex-shrink: 0;
}

.tr-saved-analysis-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.tr-saved-analysis-period {
    font-size: 11px;
    font-weight: 700;
    color: #0f172a;
}

.tr-saved-analysis-name {
    font-size: 11px;
    color: #64748b;
    word-break: break-word;
}

.tr-slot-status {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.tr-slot-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #22c55e;
    color: #fff;
    font-weight: 700;
    font-size: 14px;
}

.tr-slot-err {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #ef4444;
    color: #fff;
    font-weight: 700;
    font-size: 14px;
}

.tr-slot-upload-btn {
    cursor: pointer;
}

.tr-slot-spinner {
    width: 20px;
    height: 20px;
    border: 2.5px solid #e2e8f0;
    border-top-color: #0073e6;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* Actions */

.tr-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tr-build-btn {
    flex: 1;
}

.tr-build-btn.disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* Processing */

.tr-processing {
    text-align: center;
    padding: 60px 20px;
}

.tr-processing-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
}

.tr-processing-copy {
    margin: 8px auto 0;
    max-width: 420px;
    font-size: 14px;
    color: #64748b;
    line-height: 1.6;
}

.tr-processing-counter {
    margin-top: 10px;
    font-size: 12px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.tr-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e2e8f0;
    border-top-color: #0073e6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

.tr-error {
    text-align: center;
    padding: 20px;
    color: #dc2626;
    font-size: 14px;
}

/* Graph layout */

.tr-graph-toolbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 16px;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.tr-graph-info {
    font-size: 13px;
    color: #64748b;
}

.tr-graph-sep {
    flex: 1;
}

.pm-graph-limits {
    margin-top: 10px;
    padding: 8px 0;
    border-top: 1px solid var(--color-border-light);
}
.pm-graph-limit-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}
.pm-graph-limit-field {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.pm-graph-limit-label {
    font-size: 10px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.pm-graph-limit-input {
    width: 64px;
    padding: 4px 8px;
    border: 1px solid var(--color-border-light);
    border-radius: 6px;
    font-size: 12px;
    text-align: center;
    background: rgba(209, 213, 219, 0.10);
    color: var(--color-text);
}
.pm-graph-limit-input::placeholder {
    color: #94a3b8;
}
.pm-graph-limit-input:focus {
    outline: none;
    border-color: rgba(0, 115, 230, 0.4);
}
.pm-graph-limit-row .btn {
    align-self: flex-end;
    margin-bottom: 1px;
}

.tr-graph-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.tr-graph-area {
    flex: 1;
    position: relative;
    overflow: hidden;
    min-height: 500px;
}

.tr-graph-area svg {
    display: block;
}

.tr-graph-sidebar {
    width: 320px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    border-left: 1px solid #e2e8f0;
    background: #fafbfc;
    padding: 0;
    scrollbar-gutter: stable;
    scrollbar-width: auto;
    scrollbar-color: rgba(100, 116, 139, 0.7) rgba(226, 232, 240, 0.72);
}

.tr-graph-sidebar::-webkit-scrollbar {
    width: 12px;
}

.tr-graph-sidebar::-webkit-scrollbar-track {
    background: rgba(226, 232, 240, 0.72);
    border-radius: 999px;
}

.tr-graph-sidebar::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, 0.7);
    border-radius: 999px;
    border: 2px solid rgba(226, 232, 240, 0.72);
}

.tr-graph-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(71, 85, 105, 0.9);
}

/* Sidebar */

.tr-sb-section {
    padding: 16px;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.tr-sb-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    margin-bottom: 10px;
}

.tr-sb-manager,
.tr-sb-member,
.tr-sb-shared {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
}

.tr-sb-color {
    width: 4px;
    height: 24px;
    border-radius: 2px;
    flex-shrink: 0;
}

.tr-sb-photo {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.tr-sb-info {
    min-width: 0;
    flex: 1;
}

.tr-sb-name {
    font-weight: 600;
    font-size: 13px;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tr-sb-meta {
    font-size: 11px;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tr-sb-shared-dots {
    display: flex;
    gap: 3px;
    flex-shrink: 0;
}

.tr-sb-member-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    flex-shrink: 0;
}

.tr-sb-member-checkbox {
    width: 15px;
    height: 15px;
    accent-color: var(--color-primary, #0073e6);
}

.tr-sb-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.tr-sb-section-compact {
    padding: 8px 16px;
}
.tr-sb-cluster-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Sidebar tabs (Contacts / Accounts) */

.tr-sb-tabs {
    display: flex;
    border-bottom: 1px solid var(--color-border-light, #e5e7eb);
    padding: 0 16px;
    gap: 0;
    flex-shrink: 0;
}

.tr-sb-tab {
    flex: 1;
    background: none;
    border: none;
    padding: 8px 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-muted, #64748b);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
    text-align: center;
}

.tr-sb-tab.active {
    color: var(--color-primary, #0073e6);
    border-bottom-color: var(--color-primary, #0073e6);
}

.tr-sb-tab:hover { color: var(--color-text); }

/* Toggle/collapse */

.tr-sb-toggle {
    cursor: pointer;
    user-select: none;
}

.tr-sb-chevron {
    font-size: 10px;
    display: inline-block;
    transition: transform 0.2s;
    margin-left: 4px;
}

.tr-sb-chevron.rotated { transform: rotate(-90deg); }

.tr-sb-collapsible {
    overflow-y: auto;
    overflow-x: hidden;
    transition: max-height 0.3s ease;
    max-height: 600px;
    scrollbar-gutter: stable;
    scrollbar-width: auto;
    scrollbar-color: rgba(100, 116, 139, 0.65) rgba(226, 232, 240, 0.7);
    padding-right: 6px;
}

.tr-sb-collapsible.collapsed {
    max-height: 0;
    overflow: hidden;
    padding-right: 0;
}

.tr-sb-collapsible::-webkit-scrollbar {
    width: 12px;
}

.tr-sb-collapsible::-webkit-scrollbar-track {
    background: rgba(226, 232, 240, 0.7);
    border-radius: 999px;
}

.tr-sb-collapsible::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, 0.65);
    border-radius: 999px;
    border: 2px solid rgba(226, 232, 240, 0.7);
}

.tr-sb-collapsible::-webkit-scrollbar-thumb:hover {
    background: rgba(71, 85, 105, 0.85);
}

/* Filter bar */

.tr-sb-filter-bar {
    padding: 8px 16px;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    gap: 6px;
}

.tr-sb-filter-input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--color-border-light, #e5e7eb);
    border-radius: 6px;
    font-size: 12px;
    background: #fff;
    outline: none;
    box-sizing: border-box;
}

.tr-sb-filter-input:focus {
    border-color: var(--color-primary, #0073e6);
    box-shadow: 0 0 0 2px rgba(0, 115, 230, 0.1);
}

.tr-sb-range-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tr-sb-range-label {
    font-size: 11px;
    color: var(--color-text-muted);
    white-space: nowrap;
    min-width: 90px;
}

.tr-sb-range-slider {
    flex: 1;
    height: 4px;
    accent-color: var(--color-primary, #0073e6);
}

.tr-sb-range-slider-acct {
    accent-color: #7c3aed;
}

.tr-sb-filter-count {
    padding: 2px 16px 6px;
    font-size: 11px;
    color: var(--color-text-muted);
    font-weight: 500;
    flex-shrink: 0;
}

#trContactsPanel,
#trAccountsPanel {
    display: flex !important;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

#trContactsPanel.hidden,
#trAccountsPanel.hidden {
    display: none !important;
}

/* Scrollable list */

.tr-sb-list {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    padding: 0 16px;
}

.tr-sb-contact-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 7px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}
.tr-sb-contact-item:last-child { border-bottom: none; }

.tr-sb-contact-main {
    flex: 1;
    min-width: 0;
}

.tr-sb-contact-footer {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.tr-sb-contact-dots {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}

.tr-sb-score-badge {
    flex-shrink: 0;
    min-width: 36px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: rgba(0, 115, 230, 0.08);
    color: #0073e6;
    font-size: 11px;
    font-weight: 700;
    margin-top: 2px;
}

.tr-sb-score-badge-acct {
    background: rgba(124, 58, 237, 0.08);
    color: #7c3aed;
}

.tr-sb-score-bar {
    height: 3px;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 2px;
    margin-top: 4px;
    overflow: hidden;
}

.tr-sb-score-fill {
    height: 100%;
    background: linear-gradient(90deg, #0073e6, #38bdf8);
    border-radius: 2px;
    transition: width 0.2s;
}

.tr-sb-score-bar-acct { }
.tr-sb-score-fill-acct {
    background: linear-gradient(90deg, #7c3aed, #c084fc);
}

/* Accounts */

.tr-sb-account {
    padding: 8px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}
.tr-sb-account:last-child { border-bottom: none; }

.tr-sb-account-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tr-sb-account-icon {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: rgba(99, 102, 241, 0.08);
    color: #6366f1;
}

.tr-sb-account-details {
    margin-top: 4px;
    padding-left: 36px;
}

.tr-sb-account-dots {
    display: flex;
    align-items: center;
    gap: 3px;
    flex-wrap: wrap;
}

.tr-sb-account-dots .tr-sb-meta {
    margin-left: 4px;
}

.hidden { display: none !important; }

.tr-sb-legend {
    border-bottom: none;
}
.tr-sb-legend .tr-sb-meta {
    white-space: normal;
    line-height: 1.5;
    padding: 2px 0;
    font-style: italic;
}

@media (max-width: 800px) {
    .tr-graph-layout {
        flex-direction: column;
    }
    .tr-graph-sidebar {
        width: 100%;
        max-height: 200px;
        border-left: none;
        border-top: 1px solid #e2e8f0;
    }
}

/* ==========================================================================
   Data Management
   ========================================================================== */

.data-management-container {
    flex: 1;
    padding: 24px;
    overflow: auto;
    background:
        radial-gradient(circle at top right, rgba(0, 115, 230, 0.08), transparent 28%),
        linear-gradient(180deg, #fbfcfe 0%, #f3f6fa 100%);
}

.dm-shell {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.dm-header-card,
.dm-panel,
.dm-empty-state {
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 24px;
    box-shadow: 0 24px 50px rgba(15, 23, 42, 0.06);
}

.dm-header-card {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 28px 30px;
}

.dm-kicker {
    margin-bottom: 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--color-accent);
}

.dm-title,
.dm-section-title,
.dm-empty-title {
    color: #0f172a;
    letter-spacing: -0.02em;
}

.dm-title {
    font-size: 30px;
    line-height: 1.05;
}

.dm-copy,
.dm-empty-copy {
    margin-top: 12px;
    max-width: 820px;
    color: #475569;
    line-height: 1.7;
}

.dm-header-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: flex-start;
    gap: 10px;
}

.dm-danger-btn {
    background: #7f1d1d;
    color: #fff;
    border: 1px solid #7f1d1d;
}

.dm-danger-btn:hover {
    background: #991b1b;
}

.dm-alert {
    border-radius: 14px;
    padding: 14px 16px;
    font-weight: 500;
}

.dm-alert-error {
    border: 1px solid #fecaca;
    background: #fff1f2;
    color: #9f1239;
}

.dm-alert-success {
    border: 1px solid #bbf7d0;
    background: #f0fdf4;
    color: #166534;
}

.dm-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(360px, 0.9fr);
    gap: 20px;
    align-items: start;
}

.dm-panel {
    padding: 24px;
}

.dm-panel-header,
.dm-subsection-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.dm-section-title {
    font-size: 22px;
    line-height: 1.1;
}

.dm-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-top: 18px;
}

.dm-stat-card {
    padding: 16px;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    background: #f8fafc;
}

.dm-stat-label,
.dm-stat-meta,
.dm-subsection-count {
    color: #64748b;
}

.dm-stat-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.dm-stat-value {
    margin-top: 8px;
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
    color: #0f172a;
}

.dm-stat-meta {
    margin-top: 6px;
    font-size: 12px;
}

.dm-subsection {
    margin-top: 22px;
    padding: 18px 18px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.94) 0%, rgba(255, 255, 255, 0.98) 100%);
}

.dm-subsection.is-collapsed {
    padding-bottom: 18px;
}

.dm-subsection-title {
    font-size: 15px;
    color: #0f172a;
}

.dm-subsection-main {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.dm-subsection-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    background: #e2e8f0;
    font-size: 12px;
    font-weight: 700;
}

.dm-subsection-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.dm-subsection-btn {
    min-width: 96px;
}

.dm-subsection-body {
    margin-top: 12px;
}

.dm-empty-inline {
    margin-top: 12px;
    padding: 14px 16px;
    border: 1px dashed #cbd5e1;
    border-radius: 14px;
    color: #64748b;
    background: #f8fafc;
}

.dm-empty-state {
    padding: 40px;
}

.dm-table {
    width: 100%;
    margin-top: 12px;
    border-collapse: collapse;
}

.dm-table th,
.dm-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: top;
}

.dm-table th {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
}

.dm-table td {
    color: #0f172a;
}

.dm-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 12px;
    word-break: break-all;
}

/* ==========================================================================
   Config Editor
   ========================================================================== */

.config-container {
    padding: 0;
    max-width: 100%;
    min-height: calc(100vh - 54px);
    background: var(--color-bg);
}

.cfg-loading,
.cfg-error {
    padding: 60px 24px;
    text-align: center;
    font-size: 15px;
    color: var(--color-text-muted);
}

.cfg-error {
    color: #c0392b;
}

/* Company selector */
.cfg-selector {
    padding: 60px 24px;
    text-align: center;
}
.cfg-selector h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 24px;
}
.cfg-company-grid {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}
.cfg-company-card {
    background: var(--color-surface);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius);
    padding: 24px 32px;
    cursor: pointer;
    transition: all var(--transition);
    text-align: left;
    font-family: var(--font);
}
.cfg-company-card:hover {
    border-color: var(--color-accent);
    box-shadow: var(--shadow-md);
}
.cfg-company-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text);
}
.cfg-company-domain {
    font-size: 13px;
    color: var(--color-text-muted);
    margin-top: 4px;
}

/* Editor layout */
.cfg-editor {
    max-width: 960px;
    margin: 0 auto;
    padding: 24px;
}

.cfg-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}
.cfg-header h2 {
    font-size: 20px;
    font-weight: 600;
}
.cfg-slug {
    font-size: 12px;
    color: var(--color-text-muted);
    font-family: monospace;
}
.cfg-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cfg-save-btn {
    background: var(--color-accent);
    color: #fff;
    border: none;
    padding: 7px 18px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition);
}
.cfg-save-btn:hover:not(:disabled) {
    background: var(--color-accent-hover);
}
.cfg-save-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.cfg-save-status {
    font-size: 12px;
    font-weight: 500;
}
.cfg-save-dirty {
    color: #d97706;
}
.cfg-save-ok {
    color: #059669;
}
.cfg-save-err {
    color: #dc2626;
}

/* Sections */
.cfg-section {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    margin-bottom: 16px;
    overflow: hidden;
}

.cfg-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    cursor: pointer;
    user-select: none;
    transition: background var(--transition);
}
.cfg-section-header:hover {
    background: var(--color-bg);
}
.cfg-section-header h3 {
    font-size: 15px;
    font-weight: 600;
}
.cfg-section-chevron {
    font-size: 11px;
    color: var(--color-text-muted);
    transition: transform var(--transition);
}
.cfg-section.collapsed .cfg-section-chevron {
    transform: rotate(-90deg);
}
.cfg-section.collapsed .cfg-section-body {
    display: none;
}

.cfg-section-body {
    padding: 0 20px 20px;
}

.cfg-section-desc {
    font-size: 13px;
    color: var(--color-text-secondary);
    line-height: 1.6;
    margin-bottom: 16px;
    padding: 10px 14px;
    background: #f8fafc;
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--color-accent);
}

/* Fields */
.cfg-field {
    margin-bottom: 18px;
}
.cfg-field-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
}
.cfg-field-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
}
.cfg-field-help {
    font-size: 12px;
    color: var(--color-text-muted);
    line-height: 1.5;
    margin-bottom: 6px;
}
.cfg-field-help-sm {
    font-size: 11px;
    color: var(--color-text-muted);
    line-height: 1.4;
    margin-bottom: 4px;
}

.cfg-input {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 13px;
    color: var(--color-text);
    background: var(--color-bg);
    transition: border-color var(--transition);
    outline: none;
}
.cfg-input:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 2px var(--color-accent-light);
}
.cfg-inline-copy {
    display: flex;
    gap: 10px;
    align-items: center;
}
.cfg-inline-copy .cfg-input {
    flex: 1 1 auto;
}
.cfg-input-sm {
    width: 120px;
}
.cfg-input-error {
    border-color: #dc2626 !important;
    box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.15) !important;
}

.cfg-select {
    padding: 6px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 13px;
    color: var(--color-text);
    background: var(--color-bg);
    cursor: pointer;
    outline: none;
}
.cfg-select:focus {
    border-color: var(--color-accent);
}

.cfg-textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: "SF Mono", "Fira Code", "Consolas", monospace;
    font-size: 12px;
    color: var(--color-text);
    background: var(--color-bg);
    resize: vertical;
    outline: none;
    line-height: 1.5;
}
.cfg-textarea:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 2px var(--color-accent-light);
}

/* Tags */
.cfg-tags-wrap {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-bg);
    padding: 6px 8px;
}
.cfg-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 4px;
}
.cfg-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 3px;
    padding: 2px 6px 2px 8px;
    font-size: 12px;
    font-family: "SF Mono", "Fira Code", "Consolas", monospace;
    color: var(--color-text);
    line-height: 1.4;
}
.cfg-tag-text {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cfg-tag-remove {
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-size: 14px;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
    border-radius: 2px;
}
.cfg-tag-remove:hover {
    color: #dc2626;
    background: rgba(220, 38, 38, 0.08);
}
.cfg-tag-add {
    margin-top: 2px;
}
.cfg-tag-input {
    width: 100%;
    border: none;
    background: transparent;
    font-family: var(--font);
    font-size: 12px;
    color: var(--color-text);
    padding: 3px 2px;
    outline: none;
}
.cfg-tag-input::placeholder {
    color: var(--color-text-muted);
}

/* Meeting type cards */
.cfg-mt-card {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    margin-bottom: 12px;
    overflow: hidden;
    transition: box-shadow var(--transition);
}
.cfg-mt-card:hover {
    box-shadow: var(--shadow-sm);
}
.cfg-mt-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #f8fafc;
    border-bottom: 1px solid var(--color-border-light);
}
.cfg-mt-priority {
    font-size: 11px;
    font-weight: 700;
    color: var(--color-accent);
    background: var(--color-accent-light);
    padding: 2px 7px;
    border-radius: 3px;
    font-family: monospace;
}
.cfg-mt-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
    flex: 1;
}
.cfg-mt-remove {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    border-radius: var(--radius-sm);
}
.cfg-mt-remove:hover {
    color: #dc2626;
    background: rgba(220, 38, 38, 0.08);
}
.cfg-mt-body {
    padding: 12px 14px;
}
.cfg-mt-field {
    margin-bottom: 12px;
}
.cfg-mt-field:last-child {
    margin-bottom: 0;
}
.cfg-mt-field > label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-bottom: 2px;
}

.cfg-toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    cursor: pointer;
}
.cfg-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--color-accent);
}

/* Proximity grid */
.cfg-prox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 8px;
}
.cfg-prox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    background: #f8fafc;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border-light);
}
.cfg-prox-label {
    flex: 1;
    font-size: 13px;
    color: var(--color-text);
    font-weight: 500;
}
.cfg-prox-input {
    width: 60px;
    padding: 4px 8px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: monospace;
    font-size: 13px;
    text-align: center;
    color: var(--color-text);
    background: var(--color-surface);
    outline: none;
}
.cfg-prox-input:focus {
    border-color: var(--color-accent);
}

.cfg-add-type-btn,
.cfg-add-prox-btn {
    margin-top: 8px;
}

/* ==========================================================================
   Org Editor
   ========================================================================== */

.orgeditor-container {
    min-height: calc(100vh - 54px);
    background: var(--color-bg);
}

.oe-loading,
.oe-error {
    padding: 60px 24px;
    text-align: center;
    font-size: 15px;
    color: var(--color-text-muted);
}
.oe-error { color: #c0392b; }

/* Company picker */
.oe-picker {
    padding: 60px 24px;
    text-align: center;
}
.oe-picker h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 24px;
}
.oe-picker-grid {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}
.oe-picker-card {
    background: var(--color-surface);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius);
    padding: 24px 32px;
    cursor: pointer;
    transition: all var(--transition);
    text-align: left;
    font-family: var(--font);
}
.oe-picker-card:hover {
    border-color: var(--color-accent);
    box-shadow: var(--shadow-md);
}
.oe-picker-new {
    border-style: dashed;
}
.oe-picker-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text);
}
.oe-picker-domain {
    font-size: 13px;
    color: var(--color-text-muted);
    margin-top: 4px;
}

/* Toolbar */
.oe-editor {
    height: calc(100vh - 54px);
    display: flex;
    flex-direction: column;
}

.oe-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    flex-wrap: wrap;
    flex-shrink: 0;
}
.oe-toolbar-left {
    display: flex;
    align-items: baseline;
    gap: 8px;
}
.oe-title {
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
}
.oe-count {
    font-size: 12px;
    font-weight: 400;
    color: var(--color-text-muted);
}
.oe-toolbar-center {
    flex: 1;
    min-width: 200px;
}
.oe-search {
    width: 100%;
    max-width: 360px;
    padding: 7px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 13px;
    background: var(--color-bg);
    color: var(--color-text);
    outline: none;
    transition: border-color var(--transition);
}
.oe-search:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 2px var(--color-accent-light);
}
.oe-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.oe-import-group {
    display: flex;
    gap: 4px;
}
.oe-save-status {
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}
.oe-save-dirty { color: #d97706; }
.oe-save-ok { color: #059669; }
.oe-save-err { color: #dc2626; }

/* Layout: tree + detail */
.oe-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}
.oe-tree-panel {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}
.oe-detail-panel {
    width: 380px;
    min-width: 320px;
    border-left: 1px solid var(--color-border);
    background: var(--color-surface);
    overflow-y: auto;
}

/* Tree */
.oe-tree-empty {
    padding: 60px 24px;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 14px;
}

.oe-node {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px 5px 8px;
    cursor: pointer;
    transition: background var(--transition);
    border-left: 3px solid transparent;
}
.oe-node:hover {
    background: #f1f5f9;
}
.oe-node-selected {
    background: var(--color-accent-light) !important;
    border-left-color: var(--color-accent);
}
.oe-node-dim {
    opacity: 0.4;
}

.oe-toggle {
    background: none;
    border: none;
    font-size: 12px;
    color: var(--color-text-muted);
    cursor: pointer;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
    padding: 0;
}
.oe-toggle.oe-leaf {
    visibility: hidden;
}

.oe-node-photo {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: #e2e8f0;
}
.oe-no-photo {
    display: inline-block;
    background: linear-gradient(135deg, #cbd5e1 0%, #94a3b8 100%);
}

.oe-node-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}
.oe-node-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.oe-node-pos {
    font-size: 11px;
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.oe-node-meta {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}
.oe-tag {
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 3px;
    white-space: nowrap;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.oe-tag-team {
    background: #ede9fe;
    color: #6d28d9;
}
.oe-tag-admin {
    background: #dcfce7;
    color: #166534;
    font-weight: 700;
}
.oe-tag-office {
    background: #dbeafe;
    color: #1d4ed8;
}
.oe-tag-count {
    background: #e2e8f0;
    color: #475569;
    font-weight: 600;
}

.oe-toolbar-note {
    font-size: 13px;
    color: var(--color-text-secondary);
}

.oe-subnav {
    display: inline-flex;
    gap: 6px;
    margin: 0 0 16px;
    padding: 4px;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: #f8fafc;
}
.oe-subnav-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--color-text-secondary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.oe-subnav-btn.active {
    background: var(--color-accent);
    color: #fff;
}
.oe-subnav-count {
    min-width: 22px;
    padding: 1px 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    font-size: 11px;
    text-align: center;
}

/* Detail panel */
.oe-detail-empty {
    padding: 40px 24px;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 13px;
    line-height: 1.6;
}

.oe-detail {
    padding: 20px;
}
.oe-detail-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    position: relative;
}
.oe-detail-photo {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.oe-detail-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text);
}
.oe-detail-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #dcfce7;
    color: #166534;
    font-size: 11px;
    font-weight: 700;
    vertical-align: middle;
}
.oe-detail-username {
    font-size: 12px;
    color: var(--color-text-muted);
    font-family: monospace;
}
.oe-detail-delete {
    position: absolute;
    top: 0;
    right: 0;
    background: none;
    border: none;
    font-size: 22px;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    border-radius: var(--radius-sm);
}
.oe-detail-delete:hover {
    color: #dc2626;
    background: rgba(220, 38, 38, 0.08);
}

.oe-detail-fields {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}
.oe-detail-field label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.oe-req {
    color: #dc2626;
}
.oe-detail-input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 13px;
    color: var(--color-text);
    background: var(--color-bg);
    outline: none;
    transition: border-color var(--transition);
}
.oe-detail-input:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 2px var(--color-accent-light);
}
.oe-detail-input[readonly] {
    background: #f1f5f9;
    color: var(--color-text-muted);
    cursor: not-allowed;
}

.oe-detail-link {
    font-size: 13px;
    color: var(--color-text-secondary);
    margin-bottom: 12px;
}
.oe-person-link {
    color: var(--color-accent);
    text-decoration: none;
    font-weight: 500;
}
.oe-person-link:hover {
    text-decoration: underline;
}

.oe-detail-section {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--color-text-secondary);
    margin-bottom: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--color-border-light);
}
.oe-detail-reports {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.oe-report-link {
    display: block;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    transition: background var(--transition);
}
.oe-report-link:hover {
    background: var(--color-bg);
    text-decoration: none !important;
}
.oe-report-pos {
    color: var(--color-text-muted);
    font-weight: 400;
    font-size: 11px;
}

.oe-admin-toggle-card {
    padding: 12px 14px;
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-sm);
    background: #f8fafc;
    margin-bottom: 16px;
}
.oe-admin-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
    cursor: pointer;
}
.oe-admin-toggle input {
    width: 16px;
    height: 16px;
}
.oe-admin-toggle-help {
    margin: 8px 0 0;
    font-size: 12px;
    color: var(--color-text-secondary);
    line-height: 1.5;
}

.oe-admins-layout {
    display: grid;
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
    gap: 16px;
}
.oe-admins-panel {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
    padding: 18px;
}
.oe-admins-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 14px;
}
.oe-admins-panel-header h3 {
    margin: 0;
    font-size: 18px;
    color: var(--color-text);
}
.oe-admins-kicker {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-bottom: 4px;
}
.oe-admins-copy {
    font-size: 12px;
    color: var(--color-text-secondary);
    max-width: 220px;
    line-height: 1.5;
}
.oe-admin-search-wrap {
    margin-bottom: 14px;
}
.oe-admin-current-list,
.oe-admin-directory {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.oe-admin-empty {
    padding: 28px 16px;
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-sm);
    text-align: center;
    color: var(--color-text-muted);
    font-size: 13px;
}
.oe-admin-person {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-sm);
    background: #fff;
}
.oe-admin-person-main {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.oe-admin-photo {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: #e2e8f0;
}
.oe-admin-person-copy {
    min-width: 0;
}
.oe-admin-person-title {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.oe-admin-person-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
}
.oe-admin-person-username {
    font-size: 12px;
    color: var(--color-text-muted);
    font-family: monospace;
}
.oe-admin-person-meta {
    margin-top: 2px;
    font-size: 12px;
    color: var(--color-text-secondary);
}
.oe-admin-person-tags {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 8px;
}
.oe-admin-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Import modal */
.oe-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.oe-modal {
    background: var(--color-surface);
    border-radius: var(--radius);
    padding: 28px;
    width: 560px;
    max-width: 95vw;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    position: relative;
}
.oe-modal h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
}
.oe-modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 22px;
    color: var(--color-text-muted);
    cursor: pointer;
}
.oe-modal-close:hover {
    color: var(--color-text);
}

.oe-import-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
}
.oe-import-tab {
    padding: 6px 16px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: transparent;
    font-family: var(--font);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    color: var(--color-text-secondary);
    transition: all var(--transition);
}
.oe-import-tab.active {
    background: var(--color-accent);
    color: #fff;
    border-color: var(--color-accent);
}

.oe-import-body p {
    font-size: 13px;
    color: var(--color-text-secondary);
    margin-bottom: 12px;
    line-height: 1.5;
}
.oe-import-body code {
    background: #f1f5f9;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 12px;
}
.oe-import-body input[type="file"] {
    display: block;
    margin-bottom: 12px;
    font-size: 13px;
}

.oe-import-merge-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--color-text-secondary);
    cursor: pointer;
    margin-top: 8px;
}

.oe-import-or {
    font-size: 12px;
    color: var(--color-text-muted);
    margin: 12px 0 8px;
    text-align: center;
}
.oe-import-textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: "SF Mono", "Fira Code", "Consolas", monospace;
    font-size: 12px;
    color: var(--color-text);
    background: var(--color-bg);
    resize: vertical;
    outline: none;
}
.oe-import-textarea:focus {
    border-color: var(--color-accent);
}

.oe-import-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
}

/* Manager autocomplete */
.oe-mgr-field {
    position: relative;
}
.oe-autocomplete-wrap {
    position: relative;
}
.oe-ac-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-top: none;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    box-shadow: var(--shadow-md);
    z-index: 50;
    max-height: 260px;
    overflow-y: auto;
}
.oe-ac-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    cursor: pointer;
    transition: background 80ms ease;
}
.oe-ac-item:hover {
    background: var(--color-accent-light);
}
.oe-ac-photo {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: #e2e8f0;
}
.oe-ac-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.oe-ac-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.oe-ac-meta {
    font-size: 11px;
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Manager preview below the input */
.oe-mgr-preview {
    margin-top: 6px;
    padding: 6px 10px;
    background: #f8fafc;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border-light);
}
.oe-mgr-preview a {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}
.oe-mgr-preview a:hover {
    text-decoration: underline;
}
.oe-mgr-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
}
.oe-mgr-preview span {
    font-size: 13px;
    color: var(--color-accent);
    font-weight: 500;
}
.oe-mgr-preview-pos {
    color: var(--color-text-muted) !important;
    font-weight: 400 !important;
    font-size: 11px !important;
}
.oe-mgr-unknown {
    font-size: 12px;
    color: #d97706;
    font-style: italic;
}

/* Responsive */
@media (max-width: 768px) {
    .dm-grid {
        grid-template-columns: 1fr;
    }
    .dm-header-card {
        flex-direction: column;
    }
    .dm-header-actions {
        justify-content: flex-start;
    }
    .dm-subsection-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .dm-subsection-actions {
        width: 100%;
        justify-content: flex-start;
    }
    .oe-layout {
        flex-direction: column;
    }
    .oe-admins-layout {
        grid-template-columns: 1fr;
    }
    .oe-admins-panel-header,
    .oe-admin-person {
        flex-direction: column;
        align-items: flex-start;
    }
    .oe-admin-actions {
        width: 100%;
        justify-content: flex-start;
    }
    .oe-detail-panel {
        width: 100%;
        min-width: unset;
        border-left: none;
        border-top: 1px solid var(--color-border);
        max-height: 50vh;
    }
    .oe-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .oe-toolbar-right {
        justify-content: flex-end;
    }
    .oe-subnav {
        width: 100%;
        justify-content: space-between;
    }
}
