:root {
  --stream-risk:    #6c757d;
  --stream-incident:#5b7dbb;
  --stream-admin:   #8f6cc0;
  --stream-action:  #2ca36c;
  --stream-learn:   #4fb89b;
  --stream-data:    #c27b37;
  --rag-red:    #dc3545;
  --rag-amber:  #ffc107;
  --rag-green:  #198754;
  --grid-line:  #e9ecef;
  --axis-text:  #495057;
  --row-bg:     #f8f9fa;
  --bar-stroke: rgba(0,0,0,0.15);
  --sidebar-bg: #0f172a;
  --sidebar-text: #e2e8f0;
  --sidebar-active: #1e293b;
}

html, body {
  height: 100%;
}

body {
  background-color: #f5f7fb;
}

.app-shell {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* Sidebar (vertical menu) */
.sidebar {
  width: 260px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
}

.sidebar .brand {
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar .brand i {
  font-size: 1.25rem;
}

.sidebar .nav {
  flex: 1;
  padding: 0.5rem;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sidebar .nav .nav-item {
  list-style: none;
}

.sidebar .nav .nav-link {
  color: var(--sidebar-text);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
}

.sidebar .nav .nav-link.active,
.sidebar .nav .nav-link:hover {
  background: var(--sidebar-active);
  color: #fff;
}

.sidebar .footer {
  padding: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  gap: 0.5rem;
}

.sidebar .btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.375rem;
}

/* Compact sidebar */
.sidebar.compact {
  width: 72px;
}

.sidebar.compact .brand span,
.sidebar.compact .nav .label,
.sidebar.compact .footer .label {
  display: none;
}

.sidebar.compact .nav {
  padding: 0.5rem 0.25rem;
}

.sidebar.compact .nav .nav-link {
  justify-content: center;
}

/* Main content */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  background: white;
  border-bottom: 1px solid #dee2e6;
  padding: 0.5rem 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar .actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.icon-btn {
  --size: 32px;
  width: var(--size);
  height: var(--size);
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.375rem;
}

.icon-btn i {
  font-size: 1.1rem;
  line-height: 1;
}

/* Content padding ensures Gantt doesn't touch edges */
.content {
  flex: 1;
  overflow: auto;
  padding: 1rem;
}

.gantt-container {
  width: 100%;
  overflow: auto;
  background: white;
  border-radius: 0.5rem;
  border: 1px solid #dee2e6;
  user-select: none;
}

.legend-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 2px;
  margin-right: 0.5rem;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 0.5rem;
  border: 1px solid rgba(0, 0, 0, 0.2);
}

.task-bar {
  stroke: var(--bar-stroke);
  rx: 4;
  ry: 4;
}

.task-label {
  fill: var(--axis-text);
}

.axis-label {
  fill: var(--axis-text);
}

.grid-line {
  stroke: var(--grid-line);
  stroke-width: 1;
}

.row-bg {
  fill: var(--row-bg);
}

.draggable {
  cursor: grab;
}

.dragging .draggable {
  cursor: grabbing;
}

.resize-handle {
  cursor: ew-resize;
  fill: transparent;
}

.resize-marker {
  stroke: rgba(0, 0, 0, 0.25);
}

.baseline-bar {
  stroke: #343a40;
  stroke-width: 2;
  stroke-dasharray: 4 3;
}

.today-line {
  stroke: var(--rag-red);
  stroke-width: 2;
  stroke-dasharray: 4 4;
}

.today-label {
  font-size: 12px;
  fill: var(--rag-red);
}

.milestone-diamond {
  opacity: 0.9;
  filter: drop-shadow(1px 1px 2px rgba(0, 0, 0, 0.1));
}

.milestone-label {
  font-size: 11px;
  fill: #333;
  font-weight: 500;
}

#taskTable th.actions {
  text-align: right;
}

#taskTable td.actions {
  text-align: right;
  vertical-align: middle;
}

.card-header .icon-group {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* Toggle button active states */
#toggleHideMilestones.active,
#toggleShowAll.active {
  background-color: #6c757d;
  border-color: #5c636a;
  color: white;
}

#toggleHideMilestones.active:hover,
#toggleShowAll.active:hover {
  background-color: #5c636a;
  border-color: #545b62;
}

/* Task table truncation */
.truncate-cell {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}