*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: #0d1117;
  color: #c9d1d9;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  overflow: hidden;
}

#graph-container { width: 100vw; height: 100vh; }

/* Toolbar */
#toolbar {
  position: fixed;
  top: 16px;
  left: 16px;
  display: flex;
  gap: 8px;
  z-index: 100;
}
.toolbar-btn {
  background: #161b22;
  border: 1px solid #30363d;
  color: #c9d1d9;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  transition: background 0.15s;
}
.toolbar-btn:hover { background: #21262d; }
.toolbar-btn.active { background: #1f6feb; border-color: #388bfd; color: #fff; }

/* Admin badge */
#admin-badge {
  position: fixed;
  top: 16px;
  right: 16px;
  background: #1a3a2a;
  border: 1px solid #2ea043;
  color: #3fb950;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  display: none;
  z-index: 100;
}

/* Side panel */
#side-panel {
  position: fixed;
  top: 0;
  right: -380px;
  width: 360px;
  height: 100vh;
  background: #161b22;
  border-left: 1px solid #30363d;
  overflow-y: auto;
  transition: right 0.25s ease;
  z-index: 200;
  display: flex;
  flex-direction: column;
}
#side-panel.open { right: 0; }

.panel-header {
  padding: 16px;
  border-bottom: 1px solid #21262d;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.panel-header h2 { font-size: 15px; font-weight: 600; color: #e6edf3; line-height: 1.3; }
.panel-close {
  background: none;
  border: none;
  color: #6e7681;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
}
.panel-close:hover { color: #c9d1d9; }

.panel-section {
  padding: 12px 16px;
  border-bottom: 1px solid #21262d;
}
.panel-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #6e7681;
  margin-bottom: 6px;
}
.role-badge {
  display: inline-block;
  background: #2d1b00;
  border: 1px solid #9e6a03;
  color: #e3b341;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  margin: 2px 2px 2px 0;
}
.connection-link {
  display: block;
  color: #58a6ff;
  text-decoration: none;
  font-size: 13px;
  padding: 3px 0;
  cursor: pointer;
}
.connection-link:hover { text-decoration: underline; }
.annotation-item {
  background: #0d1117;
  border: 1px solid #21262d;
  border-radius: 6px;
  padding: 8px;
  margin-bottom: 6px;
  font-size: 12px;
}
.annotation-item a { color: #58a6ff; }

/* Edit mode inputs */
.edit-field { margin-bottom: 10px; }
.edit-field label { display: block; font-size: 11px; color: #8b949e; margin-bottom: 3px; }
.edit-field input, .edit-field textarea, .edit-field select {
  width: 100%;
  background: #0d1117;
  border: 1px solid #30363d;
  color: #c9d1d9;
  padding: 5px 8px;
  border-radius: 4px;
  font-size: 13px;
}
.edit-field input:focus, .edit-field textarea:focus {
  outline: none;
  border-color: #388bfd;
}
.btn {
  padding: 6px 14px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 13px;
}
.btn-primary { background: #1f6feb; color: #fff; }
.btn-primary:hover { background: #388bfd; }
.btn-secondary { background: #21262d; color: #c9d1d9; border: 1px solid #30363d; }
.btn-secondary:hover { background: #30363d; }
.btn-danger { background: #da3633; color: #fff; }
.btn-danger:hover { background: #f85149; }

/* Admin page */
.admin-body { overflow: auto; background: #0d1117; min-height: 100vh; }
.admin-nav {
  background: #161b22;
  border-bottom: 1px solid #30363d;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 0;
  height: 48px;
}
.admin-nav a {
  color: #8b949e;
  text-decoration: none;
  padding: 14px 16px;
  font-size: 14px;
  border-bottom: 2px solid transparent;
}
.admin-nav a.active, .admin-nav a:hover { color: #c9d1d9; }
.admin-nav a.active { border-bottom-color: #388bfd; }
.admin-nav .brand { color: #e6edf3; font-weight: 600; margin-right: 16px; font-size: 15px; }
.admin-content { max-width: 900px; margin: 0 auto; padding: 24px 20px; }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th { text-align: left; padding: 8px 12px; color: #8b949e; font-size: 12px;
  border-bottom: 1px solid #21262d; }
.admin-table td { padding: 8px 12px; border-bottom: 1px solid #161b22; font-size: 13px; }
.admin-table tr:hover td { background: #161b22; }
.search-box {
  width: 100%;
  background: #161b22;
  border: 1px solid #30363d;
  color: #c9d1d9;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14px;
  margin-bottom: 16px;
}
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12px; color: #8b949e; margin-bottom: 4px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  background: #161b22;
  border: 1px solid #30363d;
  color: #c9d1d9;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 13px;
}
.page-title { font-size: 20px; font-weight: 600; color: #e6edf3; margin-bottom: 20px; }

/* Timeline bars in side panel */
.timeline-wrap { padding: 12px 16px; border-bottom: 1px solid #21262d; }
.timeline-axis { position: relative; height: 20px; margin-bottom: 4px; }
.timeline-axis-label { font-size: 10px; color: #6e7681; position: absolute; }
.timeline-bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; min-height: 20px; }
.timeline-bar-name { font-size: 11px; color: #8b949e; width: 110px; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timeline-bar-track { flex: 1; position: relative; height: 12px; background: #0d1117; border-radius: 2px; }
.timeline-bar-fill { position: absolute; height: 100%; border-radius: 2px; background: #1f6feb; }
.timeline-bar-fill.estimated { background: repeating-linear-gradient(90deg, #1f6feb 0, #1f6feb 4px, transparent 4px, transparent 8px); border: 1px dashed #388bfd; }
.timeline-bar-fill.focal { background: #facc15; }
.timeline-estimated-label { font-size: 10px; color: #6366f1; margin-left: 4px; }
