.btn,
.icon-btn {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  background: var(--surface);
  transition: transform .12s ease, border-color .12s ease, background .12s ease, box-shadow .12s ease;
}

.btn { padding: 0 12px; }
.btn:hover, .icon-btn:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
  box-shadow: 0 8px 18px rgba(0, 0, 0, .08);
}
.btn.primary {
  border-color: color-mix(in srgb, var(--accent) 70%, var(--line));
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 68%, var(--accent-3)));
  color: #061211;
  font-weight: 700;
}
.btn.secondary { background: var(--surface-2); }
.btn.danger { border-color: var(--red); color: var(--red); background: var(--red-soft); }
.icon-btn { width: 38px; padding: 0; }
.icon-btn svg, .btn svg { width: 17px; height: 17px; fill: currentColor; }

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface-2) 28%, transparent), transparent 60%),
    var(--surface);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .08);
}
.card.pad { padding: 16px; }
.card-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.kpi { display: grid; gap: 7px; }
.kpi .value { font-size: 30px; font-weight: 750; letter-spacing: 0; }
.kpi .label { color: var(--muted); font-size: 12px; text-transform: uppercase; }

.about-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.about-hero {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--accent-soft), color-mix(in srgb, var(--violet-soft) 70%, transparent));
}
.about-hero h3 { font-size: 20px; margin-bottom: 8px; }
.about-list { margin: 0; padding-left: 18px; color: var(--muted); line-height: 1.5; }

.trace-map {
  display: grid;
  grid-template-columns: repeat(8, minmax(150px, 1fr));
  gap: 10px;
  overflow: auto;
  padding-bottom: 6px;
}
.trace-lane {
  min-width: 150px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.trace-lane h3 { font-size: 12px; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.trace-node {
  display: grid;
  gap: 3px;
  margin-bottom: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  background: var(--surface);
}
.trace-node strong { font-size: 12px; }
.trace-node span { color: var(--muted); font-size: 11px; }
.inline-edit {
  width: 100%;
  min-width: 92px;
  min-height: 30px;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: var(--surface-2);
}
.dependency-network {
  display: grid;
  gap: 10px;
}
.dependency-chain {
  display: grid;
  grid-template-columns: minmax(160px, .8fr) minmax(0, 1.2fr) minmax(160px, .8fr);
  gap: 10px;
  align-items: stretch;
}
.dependency-chain > div {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.kanban-board {
  display: grid;
  grid-template-columns: repeat(5, minmax(190px, 1fr));
  gap: 12px;
  overflow: auto;
}
.kanban-col {
  min-height: 260px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.kanban-col h3 { display: flex; justify-content: space-between; align-items: center; }
.kanban-card {
  margin-bottom: 9px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  box-shadow: 0 6px 16px rgba(0,0,0,.08);
  cursor: grab;
}
.kanban-card:active { cursor: grabbing; }
.qa-tight .table-wrap { max-height: 460px; }
.qa-tight .drawer { width: min(760px, 94vw); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}
.badge:before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.badge.red, .badge.high, .badge.blocked { color: var(--red); background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 35%, var(--line)); }
.badge.amber, .badge.medium, .badge.open { color: var(--amber); background: var(--amber-soft); border-color: color-mix(in srgb, var(--amber) 35%, var(--line)); }
.badge.green, .badge.low, .badge.closed, .badge.complete { color: var(--green); background: var(--green-soft); border-color: color-mix(in srgb, var(--green) 35%, var(--line)); }
.badge.neutral { color: var(--muted); background: var(--surface-2); }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}
.toolbar .spacer { flex: 1; }
.save-status { color: var(--muted); font-size: 12px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tab {
  padding: 10px 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  background: transparent;
}
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

.drawer-host,
.modal-host {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
}
.drawer-host.open,
.modal-host.open { display: block; }
.backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, .48);
}
.drawer {
  position: absolute;
  top: 0;
  right: 0;
  width: min(720px, 92vw);
  height: 100%;
  overflow: auto;
  padding: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.modal {
  position: absolute;
  inset: 7vh auto auto 50%;
  transform: translateX(-50%);
  width: min(900px, 92vw);
  max-height: 86vh;
  overflow: auto;
  padding: 20px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.drawer-head, .modal-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 16px; }
.toast-host { position: fixed; right: 18px; bottom: 18px; z-index: 80; display: grid; gap: 8px; }
.toast { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }

.empty-state {
  padding: 28px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  background: var(--surface-2);
}

.rail { display: grid; gap: 10px; }
.step {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.step-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--line);
  font-weight: 800;
}
.step.complete .step-icon { color: #fff; border-color: var(--green); background: var(--green); }
.step.skipped .step-icon { color: var(--muted); background: var(--surface-3); }
.guided-layout { align-items: start; }
.process-assistant {
  position: sticky;
  top: calc(var(--topbar) + 18px);
}
.assistant-steps { margin-top: 14px; }
.assistant-summary { display: grid; gap: 14px; }
.warning-list { display: grid; gap: 6px; margin: 0; padding-left: 18px; color: var(--amber); }
.activity-list { display: grid; gap: 9px; }
.activity-item { display: grid; gap: 2px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.chart-box { min-height: 180px; overflow: hidden; }
.template-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 14px; }
.template-card { display: grid; gap: 12px; }
.template-card h3 { margin-bottom: 2px; font-size: 18px; }
.template-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.template-purpose { color: var(--text); margin-bottom: 0; }
.template-body {
  max-height: 360px;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-2);
}
.template-body h4 {
  margin: 14px 0 6px;
  font-size: 13px;
  color: var(--text);
  text-transform: uppercase;
}
.template-body h4:first-child { margin-top: 0; }
.template-body ul { margin: 0 0 8px 18px; padding: 0; color: var(--muted); line-height: 1.45; }
.template-body li { margin-bottom: 3px; }
.gantt-shell { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.gantt-svg { min-width: 920px; display: block; }
.gantt-row-label { font-size: 12px; fill: var(--text); font-weight: 650; }
.gantt-small { font-size: 10px; fill: var(--muted); }
.gantt-grid { stroke: var(--line); stroke-width: 1; }
.gantt-baseline { fill: var(--surface-3); stroke: var(--line-strong); }
.gantt-current { fill: var(--accent); }
.gantt-bar-hit { fill: transparent; cursor: grab; }
.gantt-bar-hit:active { cursor: grabbing; }
.gantt-handle { fill: var(--surface); stroke: var(--line-strong); stroke-width: 1.5; cursor: ew-resize; }
.gantt-drag-note { margin-top: 8px; color: var(--muted); font-size: 12px; }
.gantt-critical { stroke: var(--red); stroke-width: 2; }
.gantt-link { stroke: var(--line-strong); stroke-width: 1.5; fill: none; marker-end: url(#arrowHead); }
.gantt-today { stroke: var(--red); stroke-width: 2; stroke-dasharray: 5 4; }
.heatmap { display: grid; grid-template-columns: repeat(5, 38px); grid-template-rows: repeat(5, 34px); gap: 4px; align-items: center; }
.heat-cell { display: grid; place-items: center; border-radius: 5px; border: 1px solid var(--line); font-weight: 700; }
