/* ────────────────────────────────────────────────────────────────
   base.css — Design tokens, reset, layout skeleton
   ──────────────────────────────────────────────────────────────── */

:root {
  /* Surfaces */
  --bg:       #0d1117;
  --surface:  #161b22;
  --surface2: #1f2937;
  --surface3: #263040;

  /* Borders */
  --border:  #30363d;
  --border2: #444c56;

  /* Text */
  --text:  #e6edf3;
  --text2: #8b949e;
  --text3: #6e7681;

  /* Brand / accent */
  --accent:  #58a6ff;
  --accent2: #388bfd;

  /* Semantic */
  --success: #3fb950;
  --warn:    #d29922;
  --danger:  #f85149;
  --purple:  #bc8cff;
  --orange:  #ff7b72;

  /* Radii */
  --radius:    8px;
  --radius-lg: 12px;

  /* Sidebar width */
  --sidebar-w: 340px;
  /* Detail panel width */
  --detail-w: 360px;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── App shell ────────────────────────────────────────────────── */
#app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

#canvas-area {
  flex: 1;
  position: relative;
  overflow: hidden;
}

/* ── Shared form elements ─────────────────────────────────────── */
input, textarea, select {
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color .15s;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
}

textarea {
  resize: vertical;
}

/* ── Shared button base ───────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  border-radius: var(--radius);
  border: none;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent2);
  color: #fff;
}
.btn-primary:hover { background: var(--accent); }

.btn-ghost {
  background: var(--surface2);
  color: var(--text2);
  border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: var(--border2); }

.btn-danger {
  background: rgba(248, 81, 73, .12);
  color: var(--danger);
  border: 1px solid rgba(248, 81, 73, .3);
}
.btn-danger:hover { background: rgba(248, 81, 73, .22); }

.btn-sm { padding: 5px 10px; font-size: 11px; }

/* ── Scrollbar theme ──────────────────────────────────────────── */
::-webkit-scrollbar       { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }

/* ── Legend ───────────────────────────────────────────────────── */
#legend {
  position: fixed;
  bottom: 16px;
  /* Offset from left to clear the sidebar */
  left: calc(var(--sidebar-w) + 16px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 11px;
  color: var(--text3);
  pointer-events: none;
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.leg-item {
  display: flex;
  align-items: center;
  gap: 7px;
}
/* Top colour bar on team card */
.leg-color-bar {
  width: 20px;
  height: 3px;
  border-radius: 2px;
  flex-shrink: 0;
}
/* Lead purple left stripe */
.leg-lead-stripe {
  width: 3px;
  height: 12px;
  background: var(--purple);
  border-radius: 2px;
  flex-shrink: 0;
}
/* Subgroup chip */
.leg-chip {
  width: 20px;
  height: 10px;
  border-radius: 100px;
  border: 1px solid var(--border2);
  background: var(--surface2);
  flex-shrink: 0;
}
