/* =========================================================
   Weave - Scrollable Org Canvas & Compact Timeline Header
   ========================================================= */

/* --- Document & Natural Scrolling Reset --- */
html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    background-color: #f8fafc;
    color: #111827;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    overflow-x: auto;
    overflow-y: auto;
}

/* --- Hide Horizontal Scroll Hint --- */
.orgchart-scroll-hint {
    display: none !important;
}

/* --- Compact Non-Sticky Timeline Header --- */
.timeline-control-panel,
.timeline-card,
.orgchart-timeline-header {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px 24px;
    margin: 16px auto 20px auto;
    width: min(840px, 92vw);
    box-sizing: border-box;
    box-shadow: 0 4px 12px -2px rgba(15, 23, 42, 0.05);
    position: static;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.timeline-control-panel > div:first-child,
.timeline-header-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    font-weight: 600;
}

.timeline-control-panel h2,
.timeline-control-panel .current-date {
    font-size: 15px !important;
    font-weight: 700;
    margin: 0 !important;
    color: #0284c7;
}

.timeline-control-panel button,
.timeline-control-panel .play-btn {
    padding: 4px 12px !important;
    height: 28px !important;
    font-size: 11px !important;
    border-radius: 6px !important;
    cursor: pointer;
}

.timeline-control-panel input[type="range"] {
    width: 100%;
    height: 4px;
    margin: 4px 0;
    accent-color: #0284c7;
    cursor: pointer;
}

.timeline-control-panel > div:last-child,
.timeline-stats {
    font-size: 11px;
    color: #64748b;
    margin-top: 0;
    padding-top: 0;
}

/* --- Fully Scrollable Canvas Area --- */
.orgchart-container {
    overflow-x: auto;
    overflow-y: visible;
    min-height: 520px;
    margin: 0 20px 40px 20px;
    padding: 40px 24px;
    background-color: #ffffff;
    background-image: radial-gradient(#cbd5e1 1.5px, transparent 1.5px);
    background-size: 24px 24px;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
    box-sizing: border-box;
}

/* --- Tree Structure & Continuous Connectors --- */
.org-tree {
    display: flex;
    justify-content: center;
    min-width: fit-content;
    margin: 0 auto;
}

.org-tree ul {
    display: flex;
    justify-content: center;
    list-style: none;
    padding: 24px 0 0 0;
    margin: 0;
    position: relative;
}

/* Line dropping from parent card */
.org-tree li > ul::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 2px;
    height: 24px;
    background: #0284c7;
    transform: translateX(-50%);
}

.org-tree li {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    padding: 24px 14px 0 14px;
}

/* Line entering child card */
.org-tree li::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 2px;
    height: 24px;
    background: #0284c7;
    transform: translateX(-50%);
}

/* Continuous horizontal bar */
.org-tree li::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 2px;
    background: #0284c7;
}

.org-tree li:first-child::after { left: 50%; }
.org-tree li:last-child::after { right: 50%; }
.org-tree li:only-child::after { display: none; }

.org-tree > ul,
.org-tree > ul > li {
    padding-top: 0;
}

.org-tree > ul > li::before,
.org-tree > ul > li::after {
    display: none;
}

/* --- Node Cards --- */
.org-node {
    background: #ffffff;
    border: 1.5px solid #cbd5e1;
    border-radius: 14px;
    padding: 10px 16px 10px 12px;
    min-width: 200px;
    max-width: 260px;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    cursor: pointer;
    position: relative;
    box-shadow: 0 4px 10px -2px rgba(0, 0, 0, 0.04);
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.org-node:hover {
    border-color: #0284c7;
    box-shadow: 0 8px 18px -3px rgba(2, 132, 199, 0.15);
    transform: translateY(-2px);
    z-index: 20;
}

/* Avatar Badge */
.org-node::before {
    content: '👤';
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #f1f5f9;
    border: 1.5px solid #cbd5e1;
    margin-right: 10px;
    font-size: 14px;
    flex-shrink: 0;
}

/* Department Border Accents */
.org-node:has(.dept-engineering)::before, .org-node.dept-engineering::before { background: #e0f2fe; border-color: #0284c7; }
.org-node:has(.dept-marketing)::before, .org-node.dept-marketing::before     { background: #fef3c7; border-color: #d97706; }
.org-node:has(.dept-finance)::before, .org-node.dept-finance::before         { background: #dcfce7; border-color: #16a34a; }
.org-node:has(.dept-operations)::before, .org-node.dept-operations::before   { background: #ede9fe; border-color: #7c3aed; }
.org-node:has(.dept-executive)::before, .org-node.dept-executive::before     { background: #ffedd5; border-color: #ea580c; }

/* Text Content */
.org-node-person {
    order: 1;
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
    display: block;
    line-height: 1.2;
}

.org-node-person::before {
    display: none;
}

.org-node-title {
    order: 2;
    width: 100%;
    padding-left: 44px;
    margin-top: -12px;
    font-size: 11px;
    font-weight: 500;
    color: #64748b;
    margin-bottom: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.org-node-department {
    order: 3;
    display: inline-flex;
    align-items: center;
    margin-left: 44px;
    margin-top: 3px;
    padding: 0;
    background: transparent;
    border: none;
    font-size: 10.5px;
    font-weight: 600;
    text-transform: capitalize;
}

.org-node-department::before {
    content: '•';
    margin-right: 4px;
    font-size: 13px;
}

.dept-engineering { color: #0284c7; }
.dept-marketing   { color: #d97706; }
.dept-finance     { color: #16a34a; }
.dept-operations  { color: #7c3aed; }
.dept-executive   { color: #ea580c; }
.dept-default     { color: #475569; }

/* Highlight Root Executive Card */
.org-node.root-node,
.org-node.highlight {
    border-color: #ea580c;
    box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.12);
}