* { margin: 0; padding: 0; box-sizing: border-box; }
body { background: #0d0d1a; overflow: hidden; font-family: -apple-system, 'Segoe UI', sans-serif; color: #cdd6f4; }

#canvas-container { position: absolute; inset: 0; }
#graph-canvas { display: block; width: 100%; height: 100%; }

/* Toolbar */
#toolbar {
    position: fixed; top: 12px; right: 12px; display: flex; gap: 4px; align-items: center;
    background: #1e1e2eee; border: 1px solid #313244; border-radius: 8px; padding: 6px 10px; z-index: 10;
}
#toolbar button {
    background: #313244; border: 1px solid #45475a; color: #cdd6f4; width: 32px; height: 32px;
    border-radius: 6px; cursor: pointer; font-size: 16px; display: flex; align-items: center; justify-content: center;
}
#toolbar button:hover { background: #45475a; }
#zoom-label { font-size: 11px; color: #6c7086; min-width: 40px; text-align: center; }

/* Legend */
#legend {
    position: fixed; bottom: 12px; left: 12px; background: #1e1e2eee; border: 1px solid #313244;
    border-radius: 8px; padding: 12px 16px; z-index: 10; font-size: 12px;
}
#legend h3 { font-size: 14px; margin-bottom: 8px; color: #cba6f7; }
.legend-item { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.legend-color { width: 12px; height: 12px; border-radius: 3px; }

/* Detail panel */
.detail-panel {
    position: fixed; top: 60px; right: 12px; width: 400px; max-height: calc(100vh - 80px);
    background: #1e1e2e; border: 1px solid #45475a; border-radius: 10px; z-index: 20;
    display: flex; flex-direction: column; box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.detail-panel.hidden { display: none; }
.detail-header {
    padding: 12px 16px; border-bottom: 1px solid #313244; display: flex; align-items: center;
    font-weight: 700; font-size: 15px; color: #cba6f7;
}
.detail-close {
    margin-left: auto; background: none; border: none; color: #6c7086; font-size: 20px;
    cursor: pointer; padding: 0 4px;
}
.detail-close:hover { color: #f38ba8; }
.detail-body { padding: 16px; overflow-y: auto; flex: 1; }
.detail-description { font-size: 13px; line-height: 1.6; color: #bac2de; white-space: pre-wrap; margin-bottom: 16px; }
.detail-instructions { border-top: 1px solid #313244; padding-top: 12px; }
.detail-instructions h4 { font-size: 12px; color: #6c7086; margin-bottom: 8px; }
.detail-edit {
    width: 100%; height: 80px; background: #11111b; border: 1px solid #313244; border-radius: 6px;
    color: #cdd6f4; padding: 8px; font-size: 12px; resize: vertical; font-family: inherit;
}
.detail-edit:focus { outline: none; border-color: #cba6f7; }
.detail-buttons { display: flex; gap: 8px; margin-top: 8px; }
.detail-save {
    padding: 6px 16px; background: #313244; color: #cdd6f4; border: 1px solid #45475a;
    border-radius: 6px; cursor: pointer; font-size: 12px; font-weight: 600;
}
.detail-save:hover { background: #45475a; }
.detail-apply {
    padding: 6px 16px; background: #cba6f7; color: #11111b; border: none;
    border-radius: 6px; cursor: pointer; font-size: 12px; font-weight: 600;
}
.detail-apply:hover { background: #b48bf2; }
.detail-modifications { margin-bottom: 12px; }
.detail-mod-item {
    padding: 8px 10px; margin-bottom: 6px; background: #1a1a2e; border-radius: 6px;
    border-left: 3px solid #cba6f7; font-size: 12px; line-height: 1.5; position: relative;
}
.detail-mod-item .mod-text { color: #cdd6f4; white-space: pre-wrap; }
.detail-mod-item .mod-date { color: #585b70; font-size: 10px; margin-top: 4px; }
.detail-mod-item .mod-del {
    position: absolute; top: 4px; right: 6px; background: none; border: none;
    color: #585b70; cursor: pointer; font-size: 14px;
}
.detail-mod-item .mod-del:hover { color: #f38ba8; }
.detail-suggestion {
    margin-top: 8px; padding: 8px 12px; background: #f9e2af15; border: 1px solid #f9e2af40;
    border-radius: 6px; font-size: 12px; color: #f9e2af;
}
.detail-suggestion.hidden { display: none; }
.detail-suggestion button {
    margin-top: 6px; padding: 4px 12px; background: #f9e2af; color: #11111b; border: none;
    border-radius: 4px; cursor: pointer; font-size: 11px; font-weight: 600; margin-right: 6px;
}
.detail-suggestion button.secondary {
    background: #313244; color: #cdd6f4; border: 1px solid #45475a;
}

/* Audit panel */
.audit-panel {
    position: fixed; top: 0; left: 0; width: 420px; height: 100vh;
    background: #11111bee; border-right: 2px solid #f9e2af;
    z-index: 25; overflow-y: auto; padding: 0;
    font-size: 13px; line-height: 1.6;
    backdrop-filter: blur(8px);
}
.audit-panel.hidden { display: none; }
.audit-header {
    position: sticky; top: 0; padding: 16px 20px; background: #1e1e2e;
    border-bottom: 1px solid #313244; display: flex; align-items: center; z-index: 1;
}
.audit-header h2 { font-size: 16px; color: #f9e2af; margin: 0; }
.audit-close { margin-left: auto; background: none; border: none; color: #6c7086; font-size: 22px; cursor: pointer; }
.audit-close:hover { color: #f38ba8; }
.audit-body { padding: 16px 20px; }
.audit-section { margin-bottom: 24px; }
.audit-section h3 { font-size: 14px; color: #cba6f7; margin: 0 0 8px 0; padding-bottom: 4px; border-bottom: 1px solid #313244; }
.audit-item { margin-bottom: 12px; padding: 10px; background: #1e1e2e; border-radius: 6px; border-left: 3px solid #45475a; }
.audit-item.high { border-left-color: #f38ba8; }
.audit-item.medium { border-left-color: #f9e2af; }
.audit-item.low { border-left-color: #a6e3a1; }
.audit-item h4 { margin: 0 0 4px 0; font-size: 13px; color: #cdd6f4; }
.audit-item .priority { font-size: 10px; padding: 1px 6px; border-radius: 3px; margin-left: 6px; }
.audit-item .priority.high { background: #f38ba822; color: #f38ba8; }
.audit-item .priority.medium { background: #f9e2af22; color: #f9e2af; }
.audit-item .priority.low { background: #a6e3a122; color: #a6e3a1; }
.audit-item p { margin: 0; color: #bac2de; font-size: 12px; white-space: pre-wrap; }
.audit-run-btn {
    background: #f9e2af; color: #11111b; border: none; border-radius: 6px;
    padding: 4px 12px; cursor: pointer; font-size: 12px; font-weight: 600;
}
.audit-run-btn:hover { background: #f5d98c; }
.audit-add-btn {
    background: #cba6f7; color: #11111b; border: none; border-radius: 6px;
    padding: 4px 12px; cursor: pointer; font-size: 12px; font-weight: 600;
}
.audit-add-btn:hover { background: #b48bf2; }
.audit-reset-btn {
    background: none; border: 1px solid #45475a; color: #6c7086; border-radius: 6px;
    padding: 2px 8px; cursor: pointer;
}
.audit-reset-btn:hover { color: #f9e2af; border-color: #f9e2af; }
