/* ═══ PAGE LAYOUT ═══ */
body{margin:0;background:var(--bg);overflow:hidden;height:100vh}

/* ═══ TOP BAR ═══ */
.page-topbar{
    height:54px;
    background:var(--s);
    border-bottom:1px solid var(--b);
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:0 24px;
    flex-shrink:0;
}
.topbar-left{display:flex;align-items:center;gap:14px}
.topbar-icon{
    width:34px;height:34px;
    background:var(--t);
    border-radius:10px;
    display:flex;align-items:center;justify-content:center;
    font-size:12px;font-weight:800;color:#FDE68A;
    letter-spacing:.04em;
}
.topbar-title{font-size:15px;font-weight:700;color:var(--t)}
.topbar-subtitle{font-size:11px;color:var(--m);margin-top:1px}
.topbar-right{display:flex;align-items:center;gap:10px}
.topbar-stat{
    display:flex;align-items:center;gap:6px;
    padding:6px 14px;
    background:var(--bg);
    border:1px solid var(--b);
    border-radius:8px;
    font-size:12px;
}
.stat-dot{width:7px;height:7px;border-radius:50%}
.stat-dot.nodes{background:var(--diamond)}
.stat-dot.edges{background:var(--blue)}
.stat-dot.types{background:var(--gold)}
.stat-label{color:var(--m);font-weight:500}
.stat-value{color:var(--t);font-weight:700;font-family:'Fraunces',serif}

/* ═══ GRAPH CONTAINER ═══ */
.graph-container{
    width:100%;
    height:calc(100vh - 54px);
    position:relative;
    background:var(--bg);
}
.graph-svg{width:100%;height:100%;cursor:grab}
.graph-svg:active{cursor:grabbing}

/* ═══ CONTROLS ═══ */
.controls{
    position:absolute;
    top:16px;left:16px;
    display:flex;flex-direction:column;gap:4px;
    z-index:50;
}
.ctrl-btn{
    width:38px;height:38px;
    background:var(--s);
    border:1px solid var(--b);
    border-radius:var(--rs);
    color:var(--m);
    font-size:16px;
    cursor:pointer;
    display:flex;align-items:center;justify-content:center;
    transition:all .2s;
    font-family:'Outfit',sans-serif;
}
.ctrl-btn:hover{background:var(--bg);color:var(--t);border-color:var(--m)}
.ctrl-btn.active{background:var(--gold-l);color:var(--gold);border-color:var(--gold-b)}
.ctrl-divider{height:1px;background:var(--b);margin:4px 6px}

/* ═══ LEGEND ═══ */
.legend{
    position:absolute;
    bottom:16px;left:16px;
    background:var(--s);
    border:1px solid var(--b);
    border-radius:var(--r);
    padding:14px 18px;
    z-index:50;
    min-width:180px;
    box-shadow:0 2px 8px rgba(0,0,0,0.04);
}
.legend-title{
    font-size:10px;font-weight:700;color:var(--m);
    text-transform:uppercase;letter-spacing:.1em;margin-bottom:10px;
}
.legend-items{display:flex;flex-direction:column;gap:7px}
.legend-item{display:flex;align-items:center;gap:10px;font-size:12px}
.legend-dot{width:10px;height:10px;border-radius:50%;flex-shrink:0;border:1px solid rgba(0,0,0,0.08)}
.legend-label{color:var(--m);font-weight:500}
.legend-count{margin-left:auto;color:var(--t);font-weight:700;font-size:12px;font-family:'Fraunces',serif}

/* ═══ DETAIL PANEL ═══ */
.detail-panel{
    position:absolute;
    top:16px;right:16px;
    width:320px;
    max-height:calc(100vh - 100px);
    overflow-y:auto;
    background:var(--s);
    border:1px solid var(--b);
    border-radius:var(--r);
    z-index:50;
    box-shadow:0 4px 16px rgba(0,0,0,0.06);
    display:none;
    animation:slideIn .2s ease;
}
.detail-panel.open{display:block}
@keyframes slideIn{
    from{opacity:0;transform:translateX(12px)}
    to{opacity:1;transform:translateX(0)}
}
.detail-header{
    padding:14px 18px;
    border-bottom:1px solid var(--b);
    display:flex;align-items:center;justify-content:space-between;
}
.detail-type{display:flex;align-items:center;gap:8px}
.detail-type-dot{width:10px;height:10px;border-radius:50%}
.detail-type-label{
    font-size:10px;font-weight:700;
    text-transform:uppercase;letter-spacing:.08em;color:var(--m);
}
.detail-close{
    background:none;border:none;color:var(--m);cursor:pointer;font-size:16px;
    width:28px;height:28px;border-radius:var(--rs);
    display:flex;align-items:center;justify-content:center;
    transition:all .15s;
}
.detail-close:hover{background:var(--bg);color:var(--t)}
.detail-body{padding:16px 18px}
.detail-name{
    font-size:16px;font-weight:700;
    color:var(--t);margin-bottom:14px;line-height:1.3;
    font-family:'Fraunces',serif;
}
.detail-row{
    display:flex;align-items:flex-start;gap:8px;
    padding:8px 0;
    border-bottom:1px solid var(--b);
    font-size:12px;
}
.detail-row:last-child{border-bottom:none}
.detail-key{color:var(--m);font-weight:600;min-width:80px;flex-shrink:0;text-transform:uppercase;font-size:10px;letter-spacing:.04em;padding-top:1px}
.detail-val{color:var(--t);line-height:1.5;font-weight:500}
.detail-conn-title{
    font-size:10px;font-weight:700;color:var(--m);
    text-transform:uppercase;letter-spacing:.08em;margin-bottom:8px;
}
.detail-conn-item{
    display:flex;align-items:center;gap:6px;
    padding:5px 0;font-size:12px;
}
.conn-arrow{font-weight:700;width:14px;font-size:11px}
.conn-arrow.out{color:var(--blue)}
.conn-arrow.in{color:var(--gold)}
.conn-label{color:var(--m);font-size:10px;font-weight:600;min-width:50px}
.conn-dot{width:6px;height:6px;border-radius:50%;flex-shrink:0}
.conn-name{color:var(--t);font-weight:500}

/* Edge detail */
.edge-detail-header{
    padding:12px 18px;
    background:var(--blue-l);
    border-bottom:1px solid var(--b);
    font-size:13px;color:var(--blue);font-weight:600;text-align:center;
}
.edge-arrow{color:var(--m);margin:0 6px}

/* ═══ SEARCH ═══ */
.search-box{
    position:absolute;
    top:16px;left:50%;transform:translateX(-50%);
    z-index:50;display:none;
}
.search-box.open{display:block}
.search-input{
    width:360px;
    padding:12px 16px 12px 40px;
    background:var(--s);
    border:1px solid var(--gold-b);
    border-radius:var(--r);
    color:var(--t);font-size:14px;outline:none;
    font-family:'Outfit',sans-serif;
    box-shadow:0 4px 16px rgba(0,0,0,0.06);
}
.search-input::placeholder{color:var(--f)}
.search-input:focus{border-color:var(--gold);box-shadow:0 0 0 3px rgba(180,83,9,0.08)}
.search-icon{
    position:absolute;left:14px;top:50%;transform:translateY(-50%);
    color:var(--m);font-size:14px;
}

/* ═══ TOOLTIP ═══ */
.node-tooltip{
    position:absolute;
    background:var(--s);
    border:1px solid var(--b);
    border-radius:var(--rs);
    padding:8px 12px;
    font-size:12px;color:var(--t);
    pointer-events:none;z-index:200;
    white-space:nowrap;
    box-shadow:0 4px 12px rgba(0,0,0,0.08);
    display:none;
}
.node-tooltip.show{display:block}
.tooltip-name{font-weight:700;font-size:13px;margin-bottom:2px}
.tooltip-type{color:var(--m);font-size:10px;text-transform:uppercase;letter-spacing:.06em;font-weight:600}